News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Inventor Performance Viewer

Started by Neo, July 09, 2009, 10:15:21 AM

Previous topic - Next topic

Neo

It's not ready for release anytime soon, but I'd like to get people's thoughts on this performance testing tool I've created for Inventor IDE recently.  It should also be easy to create and display results independently of Inventor IDE, for example to test C programs before I get support for C in Inventor, but it smoothly integrates with the performance and unit testing system that'll be in later releases.

Any ideas on things people would like to see in it?  One thing I'd like to have (and should be fairly easy) is a way of tracking performance over the development history, probably with an interface analogous to that of Google Finance.  I'd also like a "speedup view" where instead of viewing raw times, it'd show speedup factors relative to a selected test run.

The hope is that something like this can not only help make optimization faster for us, but also make it easy enough to get into that it could gain some mainstream acceptance.  Not many people know that you can get improvements like the 6x speedup I've gotten by vectorizing AQUA@Home.  :8)


mitchi

Very interesting Neil.

How easy is it to use? Those Big O calculations, what are they based off?

Neo

Quote from: mitchi on July 09, 2009, 10:33:16 AM
Very interesting Neil.

How easy is it to use? Those Big O calculations, what are they based off?
Thanks!  It's quite easy to use.  The Mersenne32 performance test is below.  Just name a function "PTest****" and the performance testing options show up.  Call PTestStartTiming and PTestStopTiming (defined inside Inventor IDE and only accessible in PTest functions) to log data.  Select what big-O scaling to use if it's not linear (though this could be roughly determined by the viewer).  Click the red run button to run the test.



To pre-emptively answer the question people may ask, yes, that's "invoke" working in 64-bit code.  :bg  It only supports a 64-bit equivalent of the 32-bit stdcall, so it doesn't support the Windows 64-bit calling convention yet, but it will; it shouldn't be too bad to handle, just more complicated than stdcall.

When you click the performance test run button, it actually does a custom compile that only includes variables and functions used by the performance test and what it calls, and what those call, etc.  There's a special entry-point function that allocates the data array, calls the performance test, and saves the data.  I'm so glad that I compile functions independently, 'cause it made this relatively easy to put into Inventor IDE.

ramguru

..to mix JAVA-junk with Assembly - shame on you  :naughty:

Neo

Quote from: ramguru on July 09, 2009, 11:12:43 PM
..to mix JAVA-junk with Assembly - shame on you  :naughty:
I'm not mixing Java with assembly.  It's a tool that happens to be written in Java to aid in assembly language development and optimization, and as much as I think it's got a lot of room for improvement, I find it strange that you dismiss it as junk based on the language it's written in instead of its capabilities or problems.  For the record, I'm not pleased with the loading time of Inventor IDE and other issues, so a friend and I will be porting it to C/C++, but that is unrelated to my question about this performance tool.  I'm requesting useful advice from the people who could make use of this the most, not meaningless ridicule, please.

mitchi

Besides, there's a big amount of work with Java in the North American market. Practicing your Java is not a stupid thing to do.

Mark Jones

There is virtually zero market for assembly coding proper, while a Java coder can find a job almost anywhere.

That may not be "right" but that's how it is. :8) Nice work btw.
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

jj2007

Hi Neo,
Just installed the Inventor IDE, out of curiosity. Looks colourful, although the fonts might be a bit larger.
Something's not so smooth when loading an asm source, e.g. \masm32\examples\exampl01\comctls\comctls.asm:
- Inventor adds some incorrect library includes, e.g.
.686p
.xmm
.model flat,stdcall

include \masm32\lib\user32.inc ; <<<<< bad new include
include \masm32\lib\kernel32.inc
include \masm32\lib\comctl32.inc

includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\comctl32.lib

include \masm32\include\windows.inc
include \masm32\include\user32.inc ; <<<<< good old include, in parallel
include \masm32\include\kernel32.inc
include \masm32\include\comctl32.inc


- The standard variable declarations get larger, e.g.
    .data
        szDisplayName db "Comctl32 Demo",0
        CommandLine   dd 0
        hWnd          dd 0

becomes
.data
;********************************************************************************************************************************
;* *
;* Variable: szDisplayName *
;* *
;* Local prototypes *
;* *
;********************************************************************************************************************************
szDisplayName db "Comctl32 Demo",0

;********************************************************************************************************************************
;* *
;* Variable: CommandLine *
;* *
;********************************************************************************************************************************
CommandLine dd 0

;********************************************************************************************************************************
;* *
;* Variable: hWnd *
;* *
;********************************************************************************************************************************
hWnd dd 0

That is good if you are paid by the line, but for normal coding I would rather see an option to switch that behaviour off.
Once Inventor saved without warning and without backup a strongly crippled asm source; fortunately, it was only one of the example sources (\masm32\examples\exampl01\minimum\minimum.asm).
Otherwise it looks good. The Java messages look optically nicer than the standard Windows MsgBox.
:U

Neo

Thanks for trying it out and reporting back!  Honestly, I'm amazed that it worked so well on code not developed with it; that's still quite the shot in the dark at the moment.  :lol

I don't think it knows anything about comctl32.inc, so I'm not too surprised that it didn't handle it well.  It has specially-abbreviated versions of windows.inc, user32.inc, kernel32.inc, and gdi32.inc in "Inventor\includes\windows\" that are much faster & easier to parse than the originals.  Loading the original windows.inc actually freezes up the program pretty badly.  They should really be in a database-esque form, but I hadn't set that up yet, and apparently the makers of SQLite think that "Threads are evil", so it could be tough to set up.  I can't remember whether I got general includes supported properly except by directly including them in the project... and that may not work either.

The hope is to eventually never have to manage include files or look at the direct source code, so the gaudy boxes are just to clearly delineate that those are doc comments for people looking at the code outside the editor.  I bet you can find a way to crash it or fail to load some code properly by putting syntax errors in function signature lines or creatively messing with the doc comments.  :wink  It should eventually be able to support that and all sorts of other stuff, of course, since not importing code properly is terrible.

I should get back to working on it; it's been on hold for months, waiting to get anyone to review a prospective license agreement.  :(

hutch--

Neo,

If you have a decent hash table or tree system you should be able to parse windows.inc in a few milliseconds or so. i have to do it just for duplicate checking.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Neo

Quote from: hutch-- on April 13, 2010, 01:27:07 AM
If you have a decent hash table or tree system you should be able to parse windows.inc in a few milliseconds or so. i have to do it just for duplicate checking.
Yep, if you're just creating a basic model of it... and if you're not in Java... and if things are in an order such that nothing refers to anything following.  :red  It supports forward references; it just takes much less time and memory if you know exactly what format every single item is in, and string processing in Java is terribly bloated.

An example of how it can quickly get insanely complicated:
If there's an expression like "myElement DWORD log2((532 shl 3)*sizeof MYSTRUCT/offset THATSTRUCT.blah) dup (?)", it actually creates a StructureMember object with a Line object for its name, for its type, and for its "initial value", each of which contain arrays of references to the things to which they refer, and each of which has the ability to be observed for changes.  It actually evaluates the expression to know what the full size is too.  Once it's created, it gets thrown into a Scope object for its Structure that has a hash by name and a hash by ID for its members.  The Scope object observes the names of what it contains in case they change, which for windows.inc would be death, but those names won't change, so I don't do that for external includes.  The hashes are also a real pain in the memory 'cause there are two hashes for each Structure (and each Function), but you wouldn't want the IDE mixing up the Scopes when you rename something (which auto-updates all references), look for references, or go to definition.  Knowing how many members there are in advance helps a lot, especially in Java.

It's complex and ugly and buggy.  I partly blame Java and partly blame my underestimating the ridiculous number of special cases needed to fully parse (i.e. including evaluating the constants) assembly code.  It still doesn't support unions or bitfields.  When I get around to moving it over to native code someday, the parsing will instantly be much better since the easy ways to write it in C/C++/assembly are the faster & better ways.  :U

hutch--

Its probably a good idea, Java has its place which I generally see as internet client side but native binaries eat it alive. I have just recently had to write a lot of HTML with some PHP and I detest internet client and server side languages with a vengeance, coming back to binary code with all of its native capacity was like a holiday.  :bg
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php