Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce allocations from DefaultMapSerializer #909

Merged

Conversation

dreis2211
Copy link
Contributor

Hi,

I've been profiling some test suites lately and noticed that Togglz does a small, but noticeable, amount of allocations when reloading feature states before & after tests:

E.g. see the following excerpts. Overall, all of the different frames account for ~1% of allocations.
image
image

The unfortunate bit here is that the work in DefaultMapSerializer could be largely skipped if the Map is empty (which it is in most default cases). So this PR checks for emptiness on (de-)serialization to save some work & allocations.

Let me know what you think.
Cheers,
Christoph

@bennetelli bennetelli self-requested a review December 7, 2022 19:01
Copy link
Member

@bennetelli bennetelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@bennetelli bennetelli merged commit aec712d into togglz:master Jan 11, 2023
MediaMarco pushed a commit to MediaMarco/togglz that referenced this pull request Jan 12, 2023
bennetelli pushed a commit that referenced this pull request Feb 3, 2023
* Upgrade from javax to jakarta namespace, including upgrades to Spring Boot 3 and Spring 6 - Currently missing modules: CDI (some more research/help needed to fix tests), Shiro (still no jakarta version available) and Cassandra (outdated)

* Fix snapshot version and re-enable ansi console

* Use Java 17 in CI

* Re-enable jacoco

* Remove trial and error code from CDIBeanFinder

* Refine some dependencies and add xml to editorconfig to keep pom formatting with 2 spaces as indent size

* Also disable dynamodb (AWS Java SDK v1 is not compatible with Java 17, should be migrated) and war sample (needs some research)

* Remove explicit spring core version in spring boot module

* Reduce allocations from DefaultMapSerializer (#909)

* Reduce overhead of TogglzTestExecutionListener (#914)

* Reduce overhead of TogglzTestExecutionListener

Signed-off-by: Christoph Dreis <christoph.dreis@innogames.com>

* Fix InMemoryStateRepositoryTest

Signed-off-by: Christoph Dreis <christoph.dreis@innogames.com>

Signed-off-by: Christoph Dreis <christoph.dreis@innogames.com>

* Remove comment

* Replace deprecated authorizeRequests method and reformat file

* Keep original filterChain formatting

* Remove thymeleaf version, let spring boot define it

* Fix spring boot war sample

* Various dependency updates

* AWS SDK dependency updates

* Dependency updates

* Reformatting and clean up of pom.xml files

* Compilation with latest htmlunit works again, had a broken local maven cache ;D

* Refactor some pom.xml files

* Fix CDI module, the @ApplicationScoped annotation has to be at class level to be discovered by new defaul bean-discovery-mode annotated in CDI 4.0

* Empty beans.xml is not needed for CDI anymore

* Remove comment

* Shiro 1.11.0 has been released with Jakarta support, so the module is re-enabled and updated

---------

Signed-off-by: Christoph Dreis <christoph.dreis@innogames.com>
Co-authored-by: Christoph Dreis <dreis2211@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants