Pull request for changes : https://github.com/ctyler/spo600-glibc/pull/6
For the last stage I ended up pushing my local changes to the classes github. The final version that I ended up with for STRCSPN is the one I mentioned in the last post. Even thought the overall speed increase is rather small ( only about 2% ) the function is now far more readable and has an overall better run time.
As for final thoughts about the course, it is a great class that allows you to experience how and why we need to develop and optimize our software for variety of reasons, power consumption and performance are very important when it comes down to the core system, and need to be working at their maximum. I really enjoyed the assembly and the way course is taught. I highly recommend anyone interested in software portability and optimizations to take this course in the future.
With the study term coming to an end, this will be the last release for the OSD600.
The bug had to do with thimbles project activation button, it had a bad styling once pressed, which caused it to not change color making it harder for user to know what happens.
The fix required some CSS changes with dynamic linking of a class to adjust it.
For CSS :
We create a simple class and add properties to it that we want to give to our button. Then after the button is pressed we find the function that handles the event and call this line in order to add this class dynamically to the CSS.
In conclusion I want to say this course has been very useful in getting some real life coding practices and interactions with other people. Compared to other courses where everything is laid out to you, in here you have to commit by yourself in order to stay ahead. I highly recommend this course for anyone looking to either work in open source or to get more hands on experience with source control and team oriented work.
Previous post about the implementation is here : https://andreybykin.wordpress.com/2017/04/09/spo600-improving-strcspn-the-implementation/
In this post I will show the tests that I ran for my implementation of the STRCSPN function and the results of those tests.
Here is the test file that I worked with.
I am unable to test my implementation as a direct compilation of the library, but this works too. The file includes a large string that we want to search in, and a smaller string with the characters we want to find a match with. I use the clock() function to time the execution of the two functions and compare the results at the end. A simple test files but it does show a slight improvement in the run time using the new implementation.
Here are some results running this test.
As you can see there is a percentage of 1-1.3 improvement over the old function, this is on the X86 machine, on a AARCH64 machine the improvement bounces between 1.5-2 percent, with a similar test. This is all compiled with the default flag, playing around with -01 and -02 still shows somewhat similar results.
Again this is not much of an improvement in terms of performance however the new implementation does make the code look cleaner and easier to read. You can find the link to the implementation post above.
This is an update for the last time I posted. Currently I have a working version of the new implementation, that I think is ready to be code checked. In this post I want to explain the implementation and what it is suppose to do, and in the next post after this I will post my testing method as well as test scripts.
So after adjustments and trial and error this is the current iteration of my adjusted function :
Let’s break this down.
First thing up we create a bitmap with maximum number of unsigned char capacity. We will need this in order to store the values we have in the string we want to find a match in.
Next we set up a few variables that we will use, n being the return value and parity is our bit indicator.
We will initially populate the entire matchmap array with 0 using memset. This allows us to ensure we will not mistakenly match with some weird value.
while(*map) loop iterators over the characters we are looking for in the string, and for every character we cast it into an unsigned char which lets us use it as a array indexer in our matchmap. Once we have the index we place the value 1 in the position. This is for later to allow us compare the two strings.
matchmap = parity; This statement is so the null terminator never matches.
while(matchmap[(unsigned char)*s++] ^ parity). This is the part that does the work. We use the original string we are searching in and again converting it to an unsigned char to get the index value after which we use the bitwise operator ^ XOR to see if it already had the value set to one, when we initially went over the look up string. If values do not match we simply add one to N and move on to the next value, once a match is found the loop terminates and we get our final result.
This is current iteration of my implementation that I think is ready for code check.
As a side note, the original function is a mess and if anything this just helps it look nicer.
To find the tests that I ran here will be the blogpost : https://andreybykin.wordpress.com/2017/04/09/spo600-testing-strcspn-improvement/
In this release I worked on an issue listed in thimble, you can find it here : https://github.com/mozilla/thimble.mozilla.org/issues/1907
To summarize the bug, it involves changing the themes of the editor. When themed changed to dark, the inline color picker still had the same light theme, which of course should be light in this case.
To go about researching this error, it was pointed out that it involved an older commit hat ended up breaking it. Now in order to find this commit we have to do a bit of git magic. Git Bisect is a command that allows you to quickly switch to older commits and find the commit that ended up breaking a feature. Initiate the bisect by running :
- git bisect start ( Initation git bisect )
- git checkout master ( Checkout the most latest commit that we know is broken )
- git bisect bad ( We tell git that the master branch has the bad change)
- git checkout oldereCommitThatWorks ( Now lets get an older commit that we know for user works properly)
- git bisect good ( Tell git that this older commit is good )
- git bad/good ( Now go through the commits and find the one that broke)
- git bisect reset ( Finish bisect mode and return to normal git mode )
This process will get us the commit that initially broke what we are trying to do. In my case I found that the commit that took place was changing the way thimble changes themes. The change that broke it was $(“body”).toggleClass(“dark”, theme.dark); Which basically turns on a class for CSS so it can use the dark theme. When this was omitted it broke the code that changes the color picker, so for the solution I simply reverted this one line change, it still allows the previously committed code to work normally, and allows the color picker to keep using the previous way of changing themes.
My pull request was accepted and merged here : https://github.com/mozilla/brackets/pull/670