[llvm-dev] Rewriting opt-viewer in C++

Adam Nemet via llvm-dev llvm-dev at lists.llvm.org
Tue Nov 15 00:53:37 PST 2016


> On Nov 14, 2016, at 11:04 AM, Mehdi Amini <mehdi.amini at apple.com> wrote:
> 
> I agree, it is very easy to write very inefficient python code. This is not a reason to drop to C++ immediately.
> 
> Also, even if after analysis there is a bottleneck that can be solved in Python, if it represents a small part of the application it can be more appropriate to rewrite only this part in C++ and inter-op with Python.
> 
>> Mehdi
> 
>> On Nov 14, 2016, at 10:43 AM, Chris Matthews via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote:
>> 
>> Hi Bob, 
>> 
>> What size code base are you running this on?  Can you talk a little bit about the bottlenecks you found?  It doesn't make sense to me to drop the current implementation, which I bet has had little or no attempts to optimize it, without understanding the tradeoffs, both in performance and library support.  
>> 
>> 
>> On November 14, 2016 at 9:13:25 AM, Adam Nemet via llvm-dev (llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>) wrote:
>> 
>>> Again I am still undecided which way this should go but I was also wondering about the speed difference if we used the C-based parser in PyYAML (http://pyyaml.org/wiki/LibYAML <http://pyyaml.org/wiki/LibYAML>).

I’ve committed libYAML support under r286942.  It gives a speed-up of over 6x on the largest YAML file in the testsuite:

$ time -p /org/llvm/utils/opt-viewer/opt-viewer.py ./MultiSource/Applications/sqlite3/CMakeFiles/sqlite3.dir/sqlite3.c.opt.yaml html
real 415.07
user 410.00
sys 4.66

$ time -p /org/llvm/utils/opt-viewer/opt-viewer.py ./MultiSource/Applications/sqlite3/CMakeFiles/sqlite3.dir/sqlite3.c.opt.yaml html
real 63.96
user 60.03
sys 3.67

Adam


>>> 
>>>> On Nov 13, 2016, at 12:19 AM, Adam Nemet <anemet at apple.com <mailto:anemet at apple.com>> wrote:
>>>> 
>>>> Hi Bob,
>>>> 
>>>> I am glad you’re finding opt-viewer useful.  I am generally fine this being rewritten in C++.  The idea was that once the prototype proves itself to be useful this would be considered.
>>>> 
>>>> Do you have ideas how to get syntax highlighting implemented?  In Python, Pygments makes this easy.
>>>> 
>>>> Another usage model I was considering is for people who ssh to remote servers for their builds.  In this case it should be easy in Python to have  a simple HTTP server started in opt-viewer.
>>>> 
>>>> On the other hand, I am not sure if we have precedence to ship tools written in Python in LLVM so we may *have to* move. 
>>>> 
>>>> Adam
>>>> 
>>>>> On Nov 11, 2016, at 11:50 PM, Bob Haarman <llvm at inglorion.net <mailto:llvm at inglorion.net>> wrote:
>>>>> 
>>>>> Hi Adam,
>>>>> 
>>>>> Thank you for writing opt-viewer! I've been playing around with it and found it helps me understand what optimizations were performed, which were missed, and why, as well as easily navigate to the relevant code. Wanting to use it on larger projects, I found that it can take a while to analyze the optimization reports. Since there doesn't seem to be too much code in it yet, I figured it wouldn't be too much work to implement the same functionality in C++, which should give us a nice speedup compared to the current Python implementation. I have something that implements most of the functionality: the index page is generated and links to lines on source pages, which are also generated, but I haven't gotten to annotations on source pages yet. I expect to put up some code for review next week, but wanted to post here in case others are thinking along similar lines so we can hopefully avoid duplicating effort.
>>>>> 
>>>>> Cheers,
>>>>> 
>>>>> Bob
>>>>> 
>>>> 
>>> 
>>> _______________________________________________
>>> LLVM Developers mailing list
>>> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161115/dd24ab7a/attachment.html>


More information about the llvm-dev mailing list