@bennyboy , you say you are an experienced web developer. Could you please look into my PicoBlaze Simulator in JavaScript and tell me how I could speed it up? I cannot diagnose why it is so slow.
Our server costs ~$56 per month to run. Please consider donating or becoming a Patron to help keep the site running. Help us gain new members by following us on Twitter and liking our page on Facebook!
Current time: November 21, 2024, 6:12 am
Thread Rating:
PicoBlaze Simulator in JavaScript
|
(August 12, 2022 at 7:26 am)FlatAssembler Wrote: @bennyboy , you say you are an experienced web developer. Could you please look into my PicoBlaze Simulator in JavaScript and tell me how I could speed it up? I cannot diagnose why it is so slow. Maybe you should either take some remedial courses or hire yourself a tutor. Boru
‘I can’t be having with this.’ - Esmeralda Weatherwax
(August 12, 2022 at 7:26 am)FlatAssembler Wrote: @bennyboy , you say you are an experienced web developer. Could you please look into my PicoBlaze Simulator in JavaScript and tell me how I could speed it up? I cannot diagnose why it is so slow. No-one is going to help you on such a generic question. First, write a series of performance tests with timings. Then, use the a performance tool on whatever Javascript system you are on (the one in Chrome are good). Look for hot spots in the bottom-up profiling. When coding for performance, I always have an idea of the performance I'm expecting. I break down the pieces and check the speed of each. If you aren't testing with actual numbers, you have nothing to go by. (August 12, 2022 at 9:24 am)HappySkeptic Wrote:(August 12, 2022 at 7:26 am)FlatAssembler Wrote: @bennyboy , you say you are an experienced web developer. Could you please look into my PicoBlaze Simulator in JavaScript and tell me how I could speed it up? I cannot diagnose why it is so slow. Whence am I supposed to know all those things? I am just a third-year computer science student. And I have also been using a hell lots of things we haven't been taught at the university in my program. (August 12, 2022 at 7:28 am)BrianSoddingBoru4 Wrote:(August 12, 2022 at 7:26 am)FlatAssembler Wrote: @bennyboy , you say you are an experienced web developer. Could you please look into my PicoBlaze Simulator in JavaScript and tell me how I could speed it up? I cannot diagnose why it is so slow. What are "remedial courses"? What's a "tutor"? (August 12, 2022 at 1:43 pm)FlatAssembler Wrote:(August 12, 2022 at 7:28 am)BrianSoddingBoru4 Wrote: Maybe you should either take some remedial courses or hire yourself a tutor. Remedial courses are ones you take to learn (or re-learn) the basics. A tutor is a private teacher. Boru
‘I can’t be having with this.’ - Esmeralda Weatherwax
(August 12, 2022 at 1:41 pm)FlatAssembler Wrote:(August 12, 2022 at 9:24 am)HappySkeptic Wrote: No-one is going to help you on such a generic question. First, write a series of performance tests with timings. Then, use the a performance tool on whatever Javascript system you are on (the one in Chrome are good). Look for hot spots in the bottom-up profiling. If you’ve been at this for three years and don’t understand performance tests, maybe you should enroll in a different CS programme. Boru
‘I can’t be having with this.’ - Esmeralda Weatherwax
RE: PicoBlaze Simulator in JavaScript
August 12, 2022 at 4:37 pm
(This post was last modified: August 12, 2022 at 4:37 pm by HappySkeptic.)
(August 12, 2022 at 1:41 pm)FlatAssembler Wrote:(August 12, 2022 at 9:24 am)HappySkeptic Wrote: No-one is going to help you on such a generic question. First, write a series of performance tests with timings. Then, use the a performance tool on whatever Javascript system you are on (the one in Chrome are good). Look for hot spots in the bottom-up profiling. A performance test is just a test program. It could be part of a unit-test. Just have it do something in a loop 1000 times (or some large-enough number). In Javascript Code: var start = performance.now(); You said your program is "slow". How do you know? You must have expectations. At least this way you can check if something is slow or not, and find out if you fixed it or not, by comparing these numbers. If something is slow, do a bunch of work in the loop, and do performance timing using the F12 developer console Performance tab in Chrome. You can start the recording from some "pause" point in your code, or you can start it with a page reload, and stop it when your code has finished. Look for the bottom-up methods, and check for calls that use a majority of the time. RE: PicoBlaze Simulator in JavaScript
August 12, 2022 at 6:34 pm
(This post was last modified: August 12, 2022 at 6:50 pm by bennyboy.)
(August 12, 2022 at 7:26 am)FlatAssembler Wrote: @bennyboy , you say you are an experienced web developer. Could you please look into my PicoBlaze Simulator in JavaScript and tell me how I could speed it up? I cannot diagnose why it is so slow. Yes, I think so. This is not really a web issue, though-- it would be the same in any language running under any framework. In `assembler.js`, your main loop, "assemble", has 2 problems: 1) From an engineering perspective, it is absolutely unreadable. I've never seen that many if/else statements on a single page in my life. Let's say you have one or two mistakes in all those statements-- hell if you'll find ANYONE willing to go through that pile of spaghetti to find them. 2) From an efficiency perspective, you seem to be doing dozens (hundreds?) of conditional operations on each node. You need to use switch statements or some other type of logic to reduce unnecessary checks. Also: you have this Code: if (node.children[0].getRegisterNumber(context.namedRegisters) === "none") DoErrorStuff{}; Code: var IsRegister = node.children[0].getRegisterNumber(context.namedRegisters) !== "none" (August 12, 2022 at 6:34 pm)bennyboy Wrote:(August 12, 2022 at 7:26 am)FlatAssembler Wrote: @bennyboy , you say you are an experienced web developer. Could you please look into my PicoBlaze Simulator in JavaScript and tell me how I could speed it up? I cannot diagnose why it is so slow. Thank you, it would be a good thing to speed up the assembler a bit. But the assembler is, at least for the test programs, already running at an acceptable speed. It is the simulator that is running way too slowly. |
« Next Oldest | Next Newest »
|
Possibly Related Threads... | |||||
Thread | Author | Replies | Views | Last Post | |
A weird bug in the preprocessor of PicoBlaze Simulator in JavaScript | FlatAssembler | 81 | 9165 |
December 19, 2023 at 4:46 pm Last Post: BrianSoddingBoru4 |
|
Reformatting tools for JavaScript | FlatAssembler | 0 | 449 |
June 14, 2020 at 10:13 am Last Post: FlatAssembler |
|
Anatomy of religion in RELIGION SIMULATOR game | gravitysoftware | 12 | 3369 |
February 8, 2015 at 12:52 pm Last Post: c172 |
|
Analysis of a Facebook social engineering/Javascript "hack" | Autumnlicious | 4 | 3491 |
March 2, 2011 at 9:29 am Last Post: fr0d0 |
Users browsing this thread: 1 Guest(s)