|
From: | Marek Pietrzak |
Subject: | Re: [Simulavr-devel] simulation with serialrx/tx is broken |
Date: | Sat, 12 May 2012 14:06:32 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 |
On 05/12/2012 10:44 AM, Klaus Rudolph wrote:
I don't want to speak too much for Petr, it's all about performance and for me it matters as my laptop turns into fan heater when simulation runs. Commit comment for this (don't miss the link with discussion):Marek Pietrzak wrote:The same here, recently I returned to my Python simulation playground and discovered it no longer works with latest version. I analysed diffs and discovered Petr had introduced min heap for step ordering which is a good move forward,Can you explain why this is a move forward. What is the benefit of replacing the STL implementation?yet his implementation appears to be broken. I suggest not to reinvent wheel and use STL algorithm suite (make_heap, etc.), unless there some assumptions I'm not aware of. I can provide a patch with STL's version of heap if anyone is interested.I locally put the old implementation in and all works as expected. I would not commit that, because I do not understand why this change was important. So if someone can explain the benefit of the new solution I could decide for me which solution I prefer. In general I could not see any benefit to use own algos instead of STL ones. Regards, Klaus _______________________________________________ Simulavr-devel mailing list address@hidden https://lists.nongnu.org/mailman/listinfo/simulavr-devel
Reworked std::multimap in SystemClock::Step() to binary heap -> 2.5x speedup. The multimap contains one AvrDevice* (if single-core simulation) and possibly serialrx/serialtx (if UI is used).
Allocations and deallocations in the container took ~50% of CPU time.After rework the simulation speed improved from 3.28 MIPS to 8.2 MIPS on my PC on busy-loop test using MSVC.
Similar speedup when GCC is used.(See https://savannah.nongnu.org/support/?106678 for performance details.) Still, the MinHeap::RemoveMinimumAndInsert() costs 5.5% exclusive time (6.7 ns/cycle) and SystemClock::Step() 11.5% exclusive time (possibly includes inlined stuff).
Maybe we can improve that further. Regards, Marek
[Prev in Thread] | Current Thread | [Next in Thread] |