conjure-java
conjure-java copied to clipboard
Implement optimization for Primitive lists
Before this PR
Conjure holds primitive arrays as boxed lists. Instead, we can switch to primitive array lists that are backed by primitive typed arrays (double[]) rather than lists (ArrayList<Double>).
After this PR
==COMMIT_MSG== ==COMMIT_MSG==
Possible downsides?
Generate changelog in changelog/@unreleased
changelog/@unreleasedWhat do the change types mean?
feature: A new feature of the service.improvement: An incremental improvement in the functionality or operation of the service.fix: Remedies the incorrect behaviour of a component of the service in a backwards-compatible way.break: Has the potential to break consumers of this service's API, inclusive of both Palantir services and external consumers of the service's API (e.g. customer-written software or integrations).deprecation: Advertises the intention to remove service functionality without any change to the operation of the service itself.manualTask: Requires the possibility of manual intervention (running a script, eyeballing configuration, performing database surgery, ...) at the time of upgrade for it to succeed.migration: A fully automatic upgrade migration task with no engineer input required.
Note: only one type should be chosen.
How are new versions calculated?
- ❗The
breakandmanual taskchangelog types will result in a major release! - 🐛 The
fixchangelog type will result in a minor release in most cases, and a patch release version for patch branches. This behaviour is configurable in autorelease. - ✨ All others will result in a minor version release.
Type
- [ ] Feature
- [ ] Improvement
- [ ] Fix
- [ ] Break
- [ ] Deprecation
- [ ] Manual task
- [ ] Migration
Description
Check the box to generate changelog(s)
- [ ] Generate changelog entry
In terms of sequencing, I think we should split this up into a few parts:
- new generic list factory methods ConjureCollections which do not allow null values + update codegen to use them. note that
list<any>should perhaps be allowed to contain null, asList.of(Optional.empty())serializes to[null]which deserializes as an array containing null. - new specialized list factory methods for primitives in ConjureCollections.java, however these methods return the same types as in [1], but without generic inputs. Codegen can be updated to use these where possible
- We can replace the types returned by the primitive-specialized methods with more efficient collection implementations without impacting behavior because we already have validation against nulls.
this sequencing is helpful because it enforces consistent non-nullness for all conjure collections, rather than based on specific types being used.
new generic list factory methods ConjureCollections which do not allow null values + update codegen to use them
@carterkozak Just to clarify this, should these new non-null ConjureCollections methods only be used if options.nonNullCollections is true. Otherwise, this is going to cause a break right?
That's correct