ancapdev / LightBSON.jl

High performance encoding and decoding of BSON data in Julia
MIT License
20 stars 3 forks source link

bson_simple for simple namedtuples #25

Closed poncito closed 2 years ago

poncito commented 2 years ago

before:

julia> x = (;
           f1 = 1.25,
           f2 = Int64(123),
           f3 = now(UTC),
           f4 = true,
           f5 = Int32(456),
           f6 = d128"1.2",
       )
(f1 = 1.25, f2 = 123, f3 = DateTime("2022-10-04T21:45:23.841"), f4 = true, f5 = 456, f6 = 1.2)

julia> @btime begin
           buf = $(UInt8[])
           empty!(buf)
           writer = BSONWriter(buf)
           writer[] = $x
           close(writer)
       end
  74.212 ns (0 allocations: 0 bytes)

after

julia> @btime begin
           buf = $(UInt8[])
           empty!(buf)
           writer = BSONWriter(buf)
           writer[] = $x
           close(writer)
       end
  17.743 ns (0 allocations: 0 bytes)
codecov-commenter commented 2 years ago

Codecov Report

Merging #25 (f235138) into master (ed7432c) will decrease coverage by 2.46%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master      #25      +/-   ##
==========================================
- Coverage   92.35%   89.88%   -2.47%     
==========================================
  Files          13       13              
  Lines         824      811      -13     
==========================================
- Hits          761      729      -32     
- Misses         63       82      +19     
Flag Coverage Δ
unittest 89.88% <100.00%> (-2.47%) :arrow_down:

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

Impacted Files Coverage Δ
src/writer.jl 88.82% <ø> (-8.46%) :arrow_down:
src/LightBSON.jl 100.00% <100.00%> (ø)
src/reader.jl 91.81% <0.00%> (-1.52%) :arrow_down:

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

ancapdev commented 2 years ago

Thanks! Merged and released