randomdreams: riding up mini slickrock (Default)
randomdreams ([personal profile] randomdreams) wrote2019-03-05 08:35 pm

(no subject)

The main language I use for my test system at work is a test management package that provides a way to call lower-level language functions. It is oddly selective in what it allows you to do. Things like
if (variable OR 64)
always return '1', because it analyzes clauses as booleans, even though you think you're bitmasking, for instance. (And if this is covered in the documentation, I haven't found it.)
One of the things it provides is datalogging: you call a low-level routine, pass it a number by reference, and it chucks the number into an ASCII file. The number is associated as a value, with a key, and the key is the name of the datalogging routine.
So a chunk of datalog code would look like:
measure input_voltage_1
input_voltage_1 datalog()
and so forth.
Which is fine, but that means for every measurement I have to correctly type in what the measurement is, and that gets old fast because I'm measuring like 800 things. (Seriously. Actually more.)
I was poking around in the program's documentation today and found that because it's sort of vaguely object-oriented, I can mess around with the inherited attributes and with overloading them, and realized that I can dynamically generate names, that I can use to overwrite the names of the datalogging routine.
As a result, I converted 1023 lines of code into 7 lines of code, and the really cool part is that 256 of those lines were names I had to type in by hand, and now there aren't any names I have to type in by hand. It generates the whole works for me, because it knows what it just measured and uses that to produce the key.
I'm ridiculously pleased with this, mostly because of the massive scope of error reduction.
And I'm pretty sure this is the sort of thing that is completely meaningless to my manager, because I'm the only person who would ever use complicated stuff like this.
ranunculus: (Default)

[personal profile] ranunculus 2019-03-06 04:15 am (UTC)(link)
You, to Mgr:
I got this hint that I might be able to make a shortcut that will make it way faster and 10 to the 5th power more accurate to run data through the test system. Would you like me to take X time (X being up to 3 times longer than it actually took you) to see if this can be done? I believe that there is a very high probability that this will be a substantial savings for the company.

Makes you look good and forces him to "see" the issue. Of course if he says no, you can keep using the old system....
elusis: (Default)

[personal profile] elusis 2019-03-06 04:35 am (UTC)(link)
Excellent suggestion.
elainegrey: Inspired by Grypping/gripping beast styles from Nordic cultures (Default)

[personal profile] elainegrey 2019-03-06 02:20 pm (UTC)(link)
Cultures of support and reward are hard to build, i think. I am impressed!
elusis: (Default)

[personal profile] elusis 2019-03-06 10:02 pm (UTC)(link)
Suggestion if you don't do it already: Keep a spreadsheet of these things with dates, how much time saved, etc. so you can produce it at relevant times (evals, dressings-down, requests for salary increase, job interviews for new employers, etc.)
basefinder: (Default)

[personal profile] basefinder 2019-03-06 04:36 am (UTC)(link)
Wow, congrats on that.
darkoshi: (Default)

[personal profile] darkoshi 2019-03-06 05:23 am (UTC)(link)
> As a result, I converted 1023 lines of code into 7 lines of code

Bravo! Doing something like that would make me ridiculously pleased too :)
ivy: Two strands of ivy against a red wall (Default)

[personal profile] ivy 2019-03-06 07:26 am (UTC)(link)
Nice! That sounds like a fantastic optimization.
amaebi: black fox (Default)

[personal profile] amaebi 2019-03-06 12:04 pm (UTC)(link)
Well, I applaud you, anyway.
cordjostler: 2019 (Default)

[personal profile] cordjostler 2019-03-06 02:54 pm (UTC)(link)
That's an amazing improvement! Good job!
symbioid: (Default)

[personal profile] symbioid 2019-03-06 09:42 pm (UTC)(link)
Ah, another - "we saved the company scatloads, and all we get was this... chirping"