Skip to content

Instantly share code, notes, and snippets.

@lazamar
Created July 3, 2024 11:15
Show Gist options
  • Save lazamar/dac00ad2d90b2b92b3904ee432f0c62c to your computer and use it in GitHub Desktop.
Save lazamar/dac00ad2d90b2b92b3904ee432f0c62c to your computer and use it in GitHub Desktop.
Profile of compressor
Wed Jul 3 12:04 2024 Time and Allocation Profiling Report (Final)
main +RTS -p -RTS test ghcup
total time = 56.65 secs (56648 ticks @ 1000 us, 1 processor)
total alloc = 338,254,238,432 bytes (excludes profiling overheads)
COST CENTRE MODULE SRC %time %alloc
serialize.write Main Main.hs:(99,3)-(107,53) 27.6 27.7
deserialize.getBit Main Main.hs:(132,3)-(139,44) 18.6 24.6
countFrequency Main Main.hs:46:1-49 11.7 15.4
decode.go Main Main.hs:(80,3)-(86,40) 9.7 2.4
deserialize.bits Main Main.hs:124:3-31 9.0 12.3
encode.encoded Main Main.hs:72:3-33 8.6 12.7
deserialize.getBit.bit Main Main.hs:139:7-44 6.9 0.0
encode.codeFor Main Main.hs:73:3-35 2.8 0.0
compress Main Main.hs:(152,1)-(157,18) 1.4 2.7
deserialize.toBits Main Main.hs:129:3-35 1.3 1.0
deserialize.chars Main Main.hs:126:3-36 0.6 1.1
individual inherited
COST CENTRE MODULE SRC no. entries %time %alloc %time %alloc
MAIN MAIN <built-in> 187 0 0.0 0.0 100.0 100.0
CAF Main <entire-module> 373 0 0.0 0.0 0.0 0.0
buildCodes Main Main.hs:(59,1)-(66,30) 392 1 0.0 0.0 0.0 0.0
buildTree Main Main.hs:(49,1)-(56,44) 395 1 0.0 0.0 0.0 0.0
countFrequency Main Main.hs:46:1-49 383 1 0.0 0.0 0.0 0.0
main Main Main.hs:(189,1)-(199,7) 374 1 0.0 0.0 0.0 0.0
deserialize Main Main.hs:(117,1)-(149,33) 419 0 0.0 0.0 0.0 0.0
deserialize.deserializeFreqMap Main Main.hs:(142,3)-(149,33) 421 1 0.0 0.0 0.0 0.0
deserialize.(...) Main Main.hs:(119,3)-(122,17) 420 0 0.0 0.0 0.0 0.0
CAF System.Process.Posix <entire-module> 369 0 0.0 0.0 0.0 0.0
CAF System.Posix.Signals <entire-module> 368 0 0.0 0.0 0.0 0.0
CAF GHC.Conc.Signal <entire-module> 298 0 0.0 0.0 0.0 0.0
CAF GHC.Float <entire-module> 290 0 0.0 0.0 0.0 0.0
CAF GHC.IO.Encoding <entire-module> 280 0 0.0 0.0 0.0 0.0
CAF GHC.IO.Encoding.Iconv <entire-module> 278 0 0.0 0.0 0.0 0.0
CAF GHC.IO.FD <entire-module> 271 0 0.0 0.0 0.0 0.0
CAF GHC.IO.Handle.FD <entire-module> 269 0 0.0 0.0 0.0 0.0
CAF GHC.Read <entire-module> 252 0 0.0 0.0 0.0 0.0
CAF GHC.TopHandler <entire-module> 242 0 0.0 0.0 0.0 0.0
CAF Text.Printf <entire-module> 229 0 0.0 0.0 0.0 0.0
CAF Data.Typeable.Internal <entire-module> 221 0 0.0 0.0 0.0 0.0
main Main Main.hs:(189,1)-(199,7) 375 0 0.0 0.0 100.0 100.0
test Main Main.hs:(168,1)-(186,19) 376 1 0.5 0.0 100.0 100.0
test.timed Main Main.hs:(179,5)-(186,19) 377 2 0.0 0.0 99.5 100.0
test.timed.t Main Main.hs:184:11-42 406 2 0.0 0.0 0.0 0.0
compress Main Main.hs:(152,1)-(157,18) 379 0 1.4 2.7 52.4 58.6
compress.bits Main Main.hs:155:7-35 387 1 0.0 0.0 11.4 12.7
encode Main Main.hs:(69,1)-(73,35) 388 1 0.0 0.0 11.4 12.7
encode.codemap Main Main.hs:71:3-42 391 1 0.0 0.0 0.0 0.0
buildCodes Main Main.hs:(59,1)-(66,30) 393 0 0.0 0.0 0.0 0.0
buildCodes.go Main Main.hs:(62,3)-(66,30) 394 511 0.0 0.0 0.0 0.0
buildTree Main Main.hs:(49,1)-(56,44) 396 0 0.0 0.0 0.0 0.0
compare Main Main.hs:38:3-45 397 1853 0.0 0.0 0.0 0.0
weight Main Main.hs:(41,1)-(43,17) 398 3706 0.0 0.0 0.0 0.0
buildTree.\ Main Main.hs:49:44-51 399 256 0.0 0.0 0.0 0.0
buildTree.build Main Main.hs:(51,3)-(54,49) 400 256 0.0 0.0 0.0 0.0
compare Main Main.hs:38:3-45 401 18515 0.0 0.0 0.0 0.0
weight Main Main.hs:(41,1)-(43,17) 402 37030 0.0 0.0 0.0 0.0
buildTree.merge Main Main.hs:56:3-44 403 255 0.0 0.0 0.0 0.0
weight Main Main.hs:(41,1)-(43,17) 404 508 0.0 0.0 0.0 0.0
encode.encoded Main Main.hs:72:3-33 389 1 8.6 12.7 11.4 12.7
encode.codeFor Main Main.hs:73:3-35 390 111420658 2.8 0.0 2.8 0.0
serialize Main Main.hs:(89,1)-(114,40) 381 1 0.3 0.0 27.9 27.7
serialize.write Main Main.hs:(99,3)-(107,53) 386 792722791 27.6 27.7 27.6 27.7
serialize.serializeFreqMap Main Main.hs:(110,3)-(114,40) 382 1 0.0 0.0 0.0 0.0
serialize.serializeFreqMap.\ Main Main.hs:(112,51)-(114,40) 385 256 0.0 0.0 0.0 0.0
serialize.write Main Main.hs:(99,3)-(107,53) 405 0 0.0 0.0 0.0 0.0
countFrequency Main Main.hs:46:1-49 384 0 11.7 15.4 11.7 15.4
decompress Main Main.hs:(160,1)-(165,18) 408 0 1.0 0.1 47.1 41.4
decompress.(...) Main Main.hs:162:7-38 415 1 0.0 0.0 36.4 39.0
deserialize Main Main.hs:(117,1)-(149,33) 416 1 0.0 0.0 36.4 39.0
deserialize.(...) Main Main.hs:(119,3)-(122,17) 418 1 0.0 0.0 0.0 0.0
deserialize.deserializeFreqMap Main Main.hs:(142,3)-(149,33) 424 0 0.0 0.0 0.0 0.0
deserialize.bits Main Main.hs:124:3-31 439 1 9.0 12.3 35.8 37.9
deserialize.toBits Main Main.hs:129:3-35 440 88080309 1.3 1.0 26.8 25.6
deserialize.getBit Main Main.hs:(132,3)-(139,44) 441 792722780 18.6 24.6 25.5 24.6
deserialize.getBit.bit Main Main.hs:139:7-44 442 704642472 6.9 0.0 6.9 0.0
deserialize.chars Main Main.hs:126:3-36 438 1 0.6 1.1 0.6 1.1
deserialize.freqMap Main Main.hs:(119,3)-(122,17) 417 1 0.0 0.0 0.0 0.0
deserialize.offset Main Main.hs:(119,3)-(122,17) 437 1 0.0 0.0 0.0 0.0
deserialize.deserializeFreqMap Main Main.hs:(142,3)-(149,33) 422 0 0.0 0.0 0.0 0.0
deserialize.deserializeFreqMap.len Main Main.hs:144:9-32 423 1 0.0 0.0 0.0 0.0
decompress.bits Main Main.hs:162:7-38 436 1 0.0 0.0 0.0 0.0
decompress.freqMap Main Main.hs:162:7-38 414 1 0.0 0.0 0.0 0.0
decompress.str Main Main.hs:163:7-31 410 1 0.0 0.0 9.7 2.4
decode Main Main.hs:(76,1)-(86,40) 411 1 0.0 0.0 9.7 2.4
decode.go Main Main.hs:(80,3)-(86,40) 435 816063130 9.7 2.4 9.7 2.4
decode.htree Main Main.hs:78:3-27 412 1 0.0 0.0 0.0 0.0
buildTree Main Main.hs:(49,1)-(56,44) 413 0 0.0 0.0 0.0 0.0
compare Main Main.hs:38:3-45 425 1853 0.0 0.0 0.0 0.0
weight Main Main.hs:(41,1)-(43,17) 426 3706 0.0 0.0 0.0 0.0
buildTree.\ Main Main.hs:49:44-51 427 256 0.0 0.0 0.0 0.0
buildTree.build Main Main.hs:(51,3)-(54,49) 428 256 0.0 0.0 0.0 0.0
compare Main Main.hs:38:3-45 429 18515 0.0 0.0 0.0 0.0
weight Main Main.hs:(41,1)-(43,17) 430 37030 0.0 0.0 0.0 0.0
buildTree.merge Main Main.hs:56:3-44 431 255 0.0 0.0 0.0 0.0
weight Main Main.hs:(41,1)-(43,17) 432 510 0.0 0.0 0.0 0.0
decode.total Main Main.hs:79:3-22 433 1 0.0 0.0 0.0 0.0
weight Main Main.hs:(41,1)-(43,17) 434 1 0.0 0.0 0.0 0.0
compress Main Main.hs:(152,1)-(157,18) 378 1 0.0 0.0 0.0 0.0
decompress Main Main.hs:(160,1)-(165,18) 407 1 0.0 0.0 0.0 0.0
test.mid Main Main.hs:169:7-32 380 1 0.0 0.0 0.0 0.0
test.out Main Main.hs:170:7-34 409 1 0.0 0.0 0.0 0.0
@lazamar
Copy link
Author

lazamar commented Jul 3, 2024

Profile of encoding the ghcup binary (106MB) with the code from https://github.com/lazamar/compressor.

To reproduce it:

$ ghc -O2 Main.hs -prof -fprof-auto -o main
$ ./main test ghcup  +RTS -p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment