Skip to content

Conversation

@cataphract
Copy link
Contributor

@cataphract cataphract commented Mar 8, 2023

  • Introduce two types to aid efficient serialization: MapIterableWithSize and NativeStringAddressable. The first is an entry iterable that doesn't need to be iterated twice, as it has a size(). This alleviates the need to implement Map. The second is a CharSequence that also provides a nul-terminated byte buffer with the UTF-8 representation of the string.
  • Always allocate the initial object in the beginning of the first segment. On a second WAF run, the initial object is replaced. This is allowed by the WAF (the root element, and only the root element, can be replaced between runs), saves a little bit of space and avoids creating a new ByteBuffer slice() on each run.
  • Save memory by not caching PWArgsBuffer objects. To avoid creating many of them, they are reused when possible.
  • Reduce the number of native calls to getByteBufferAddress.
  • Introduce a memory stats function.

@codecov
Copy link

codecov bot commented Mar 8, 2023

Codecov Report

Patch coverage: 85.93% and project coverage change: +0.89 🎉

Comparison is base (2c2c4dc) 56.16% compared to head (9573836) 57.05%.

Additional details and impacted files
@@             Coverage Diff              @@
##             master      #62      +/-   ##
============================================
+ Coverage     56.16%   57.05%   +0.89%     
- Complexity      116      127      +11     
============================================
  Files            31       31              
  Lines          2767     2836      +69     
  Branches        638      651      +13     
============================================
+ Hits           1554     1618      +64     
- Misses          762      763       +1     
- Partials        451      455       +4     
Flag Coverage Δ
helper 57.05% <85.93%> (+0.89%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/main/java/io/sqreen/powerwaf/Powerwaf.java 85.24% <ø> (ø)
src/main/c/powerwaf_jni.c 52.33% <68.00%> (+0.21%) ⬆️
.../java/io/sqreen/powerwaf/ByteBufferSerializer.java 83.91% <89.89%> (+0.76%) ⬆️
src/main/java/io/sqreen/powerwaf/Additive.java 75.71% <100.00%> (+3.65%) ⬆️
.../main/java/io/sqreen/powerwaf/PowerwafContext.java 94.54% <100.00%> (+0.10%) ⬆️
src/main/c/debug_helpers.c 60.00% <0.00%> (+2.22%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

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.

2 participants