To be safe, I did some profiling again on a big file.
-rw-rw-r--. 1 marco marco 1298048 May 24 21:19 big.hi
It takes 1.3 seconds to parse, process, and print. Still a steady 1MB/s.
Output from gprof:
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls ms/call ms/call name
9.88 0.08 0.08 4736519 0.00 0.00 __gnu_cxx::__atomic_add(int volatile*, int)
4.94 0.12 0.04 5241745 0.00 0.00 __gnu_cxx::__exchange_and_add(int volatile*, int)
3.70 0.15 0.03 9536286 0.00 0.00 icu_52::UnicodeString::isBogus() const
3.70 0.18 0.03 3486210 0.00 0.00 TokenVector::look(unsigned int)
3.09 0.21 0.03 18877218 0.00 0.00 icu_52::UnicodeString::length() const
2.47 0.23 0.02 5010563 0.00 0.00 Token::Token(Token const&)
2.47 0.25 0.02 4734982 0.00 0.00 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count(std::__shared_count<(__gnu_cxx::_Lock_policy)2> const&)
2.47 0.27 0.02 3486210 0.00 0.00 std::vector<Token, std::allocator<Token> >::operator[](unsigned long)
2.47 0.29 0.02 2270618 0.00 0.00 std::vector<std::shared_ptr<Ast>, std::allocator<std::shared_ptr<Ast> > >::begin() const
2.47 0.31 0.02 1483420 0.00 0.00 std::_Vector_base<std::shared_ptr<Ast>, std::allocator<std::shared_ptr<Ast> > >::~_Vector_base()
2.47 0.33 0.02 366209 0.00 0.00 Token::Token(token_t, Position const&, icu_52::UnicodeString const&)
2.47 0.35 0.02 267648 0.00 0.00 adjust_reserved(Token&&)
2.47 0.37 0.02 84864 0.00 0.00 Parser::is_qualified_prefix_operator()
1.85 0.38 0.02 8336922 0.00 0.00 Position::Position(Position const&)
1.85 0.40 0.02 7964955 0.00 0.00 Position::~Position()
1.85 0.41 0.02 4374018 0.00 0.00 std::shared_ptr<Ast>::shared_ptr(std::shared_ptr<Ast> const&)
1.85 0.43 0.02 1587171 0.00 0.00 void std::_Destroy<std::shared_ptr<Ast>*>(std::shared_ptr<Ast>*, std::shared_ptr<Ast>*)
1.23 0.44 0.01 6489602 0.00 0.00 StringCharReader::end()
1.23 0.45 0.01 6013970 0.00 0.00 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count()
1.23 0.46 0.01 5666315 0.00 0.00 std::__shared_ptr<Ast, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr()
1.23 0.47 0.01 5421190 0.00 0.00 std::shared_ptr<Ast>::~shared_ptr()
1.23 0.48 0.01 3486311 0.00 0.00 std::vector<Token, std::allocator<Token> >::size() const
1.23 0.49 0.01 2441729 0.00 0.00 Token::tag() const
Looks good, around 15-20% overhead for reference counting.
Heap usage output from valgrind:
Nothing I want to change either. Looks like some spikes from lexing, parsing, and the few passes. I wonder whether libicu retains string data but, if so, nothing I want to do about that.
Addendum: Found the line still a bit puzzling. Did another leak check:
==23682==
==23682== HEAP SUMMARY:
==23682== in use at exit: 3,804 bytes in 5 blocks
==23682== total heap usage: 9,992 allocs, 9,987 frees, 1,670,914 bytes allocated
==23682==
==23682== LEAK SUMMARY:
==23682== definitely lost: 0 bytes in 0 blocks
==23682== indirectly lost: 0 bytes in 0 blocks
==23682== possibly lost: 0 bytes in 0 blocks
==23682== still reachable: 3,804 bytes in 5 blocks
==23682== suppressed: 0 bytes in 0 blocks
==23682== Rerun with --leak-check=full to see details of leaked memory
==23682==
==23682== For counts of detected and suppressed errors, rerun with: -v
==23682== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Nothing to worry about?
No comments:
Post a Comment