-
Notifications
You must be signed in to change notification settings - Fork 7
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
Change parse_row!
to a generated function to avoid dynamic dispatch
#23
Conversation
Codecov Report
@@ Coverage Diff @@
## main #23 +/- ##
==========================================
+ Coverage 95.48% 97.67% +2.19%
==========================================
Files 2 3 +1
Lines 177 258 +81
==========================================
+ Hits 169 252 +83
+ Misses 8 6 -2
Continue to review full report at Codecov.
|
Some intial timings (on files with ~250,000 rows, although of course we're currently only parsing up the end of transformers data, so ~90% of that) on
|
i think 444 allocations seems a lot more reasonable Here's how many come from just the constructors julia> for T in fieldtypes(Network)[2:end]
@show T fieldcount(T)
@btime $T(0)
println("--")
end
T = Buses
fieldcount(T) = 11
2.370 μs (27 allocations: 1.50 KiB)
--
T = Loads
fieldcount(T) = 12
2.590 μs (29 allocations: 1.66 KiB)
--
T = Generators
fieldcount(T) = 20
4.093 μs (46 allocations: 2.89 KiB)
--
T = Branches
fieldcount(T) = 17
3.596 μs (40 allocations: 2.48 KiB)
--
T = Transformers
fieldcount(T) = 73
14.476 μs (152 allocations: 10.02 KiB)
-- |
some ideas for when i have another go at refactoring the Transformers bit of this:
also, i think these are the cases that appear handle:
|
566892a
to
a3bafe5
Compare
569e46f
to
08d6278
Compare
on this branch with the simplified code (at 08d6278) julia> using PowerFlowData
julia> @time net = parse_network("test/realistic29.raw");
0.316417 seconds (128.28 k allocations: 55.867 MiB, 3.57% gc time, 33.23% compilation time)
julia> @time net = parse_network("test/realistic29.raw");
0.212118 seconds (444 allocations: 47.671 MiB, 4.25% gc time)
julia> @time net = parse_network("test/realistic30.raw");
0.222221 seconds (444 allocations: 47.608 MiB, 3.28% gc time)
julia> @time net = parse_network("test/realistic30.raw");
0.207607 seconds (444 allocations: 47.608 MiB) |
- Doesn't yet do this for Transfomers, as they need their own handling Add initial generate func for parsing Transformers Handle comments in Transformers data wherever possible Define generated function after the functions they call Put `generated` declaration on outside Remove special handling of EOL comments from generated functions Simpler generated function for Transformer data - relies on not having to handle end-of-line comments explicitly
08d6278
to
24bead9
Compare
xparse
correctly parsing up to the invalid delim) #28currently this is a bit gross... tbh the genericparse_row!
function is actually quite nice (for a generated function), but the Transformers one is pretty gross right now. And in general needs a bit of clean-up. But i think something like this is the way to go.