472,780 Members | 2,264 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,780 software developers and data experts.

hotspot profiler experience and accuracy?

I have a parser I need to optimize. It has some disk IO and a lot of
looping over characters.

I used the hotspot profiler to gain insight on optimization options. The
methods show up on on the top of this list seems fairly trivial and does
not look like CPU hogger. Nevertheless I optimized it and have 25%
performance gain according to hotspot's number.

But the numbers look skeptical. Hotspot claim 71.166 CPU seconds but the
actual elapsed time is only 54s. When measuring elapsed time instead of
CPU time the performance gain is only 13% with the profiler running and
down to 10% when not using the profiler.

Is there something I misunderstood in reading the numbers?
Jul 18 '05 #1
3 2004
On Tue, 01 Feb 2005 19:24:20 -0800, aurora wrote:
I have a parser I need to optimize. It has some disk IO and a lot of
looping over characters.

I used the hotspot profiler to gain insight on optimization options. The
methods show up on on the top of this list seems fairly trivial and does
not look like CPU hogger. Nevertheless I optimized it and have 25%
performance gain according to hotspot's number.


I can't answer your other question, but general optimization advice, since
I've been in this situation a couple of times: Generally, you're not
going to win in an interpreted language like Python* looping over all
chars. You should either eliminate those loops if possible, or move the
guts of the looping into regular expressions, which are designed to do
that sort of thing as optimally as possible. (I've never looked at the
internals, but I believe the "compile()" function in the re module isn't
just a way of conveniently sticking a regex into a variable; you are
actually creating a compiled and reasonably optimized (as long as you
don't get crazy) character scanner that you simply Can Not beat in pure
Python.)

As a last-ditch scenario, you could go to a C extension, but regexs should
be good enough, and only beatable in the simplest of cases.

Write good REs (you could ask for help, but you should probably just test
it yourself; the key thing to try for, I think, is to put as much into one
RE as possible and ask the match object which thing matched but I may be
wrong; more experienced comments welcomed), and then run the profiler
again.

In general though, the precise numbers coming out of the profiler are less
important than their relationships; as long as the relationships are
maintained the data is still good.

*: At current technology levels. Yes, someday optimization will make
looping over characters in Python even faster than C, or so the theory
goes. That's not today, or even tomorrow, though.
Jul 18 '05 #2
aurora wrote:
But the numbers look skeptical. Hotspot claim 71.166 CPU seconds but
the actual elapsed time is only 54s. When measuring elapsed time
instead of CPU time the performance gain is only 13% with the profiler
running and down to 10% when not using the profiler.

Is there something I misunderstood in reading the numbers?


Well, I'm confused too. Look at my post from a few months ago:
http://tinyurl.com/6awzj
(note that my code contained a few errors and that you need
to use the fixed code that I posted a few replies later).

Perhaps somebody can explain a bit more about this this time? :-)

At the moment, frankly, hotspot seems rather useless.

--Irmen
Jul 18 '05 #3
Thanks for pointing me to your analysis. Now I know it wasn't me doing
something wrong.

hotspot did lead me to knock down a major performance bottleneck one time.
I found that zipfile.ZipFile() basically read the entire zip file in
instantiation time, even though you may only need one file from it
subsequencely.

In anycase the number of function call seems to make sense and it should
give some insight to the runtime behaviour. The CPU time is just so
misleading.
aurora wrote:
But the numbers look skeptical. Hotspot claim 71.166 CPU seconds but
the actual elapsed time is only 54s. When measuring elapsed time
instead of CPU time the performance gain is only 13% with the profiler
running and down to 10% when not using the profiler.
Is there something I misunderstood in reading the numbers?


Well, I'm confused too. Look at my post from a few months ago:
http://tinyurl.com/6awzj
(note that my code contained a few errors and that you need
to use the fixed code that I posted a few replies later).

Perhaps somebody can explain a bit more about this this time? :-)

At the moment, frankly, hotspot seems rather useless.

--Irmen


Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: FSJOSEPH | last post by:
To the Group: Hi all, I am using a java/pdf report engine namely Elixir Report Server. The report server uses JDK 1.4.1 with hotspot server JVM support. My application runs on AIX and the...
4
by: Naresh Agarwal | last post by:
Hi What are the different kinds of JVMs exist and in what respect do they differ. What is the difference between client, server, classic and hotspot jvms? thanks, Naresh
1
by: Mario_5 | last post by:
I made a small application which print some JPanel content: .... disableDoubleBuffering(componentToBePrinted); componentToBePrinted.paint(graphics); enableDoubleBuffering(componentToBePrinted);...
2
by: Cindy | last post by:
hi, Can someone tell me what is a hotspot button? Is it done using javascript? Thanks. Regards, Cindy
6
by: cournape | last post by:
Hi there, I have some scientific application written in python. There is a good deal of list processing, but also some "simple" computation such as basic linear algebra involved. I would like to...
1
by: John J. Hughes II | last post by:
Using the Visual C#.Net editor I have created a cursor.cur file as a resource. I would like to be able to set the hotspot. The problem is the "Set Hotspot Tool" is deselected. Anyone have a clue...
2
by: Perspolis | last post by:
Hi all I want to have hotSpot on my image. I put some lables on it and when I click image I can know where I select. it works but if my image zoom in/out I lose positions of lables.. what's your...
1
by: Lespaul36 | last post by:
I have a couple of custom cursors that I loaded as embeded resource and then create a customcursor array. Is there a way to change the hotspot on the cursors. I need one of them to be closer to...
3
by: Robert | last post by:
Hi, I'm interested in two applications for javascript. A profiler and a minimizer. I found several, but I am hoping to hear with which applications some of you guys have a good experience. I...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.