On 8/14/16, 6:44 AM, "Scott Matheson" <[email protected]> wrote:
>I think this is more a question of architecture Architecture and truly understanding the problem. We've already seen how important that is. At one point we thought that computing A vs B eliminated the need to compute B vs A, but apparently that wasn't true since the loop that eliminated B vs A didn't compute the right results. We still don't truly understand the problem space but it is usually more important to not do unnecessary work than to try to do unnecessary work faster or in parallel. If there are 1400 "answers" to 1400 "questions", will those 1400 questions be asked every day? Can someone add new questions that require new answers? Will all 1400 answers change every day? If an answer changes as the question is being asked, can you give the old answer or must you delay giving the answer until the answer is updated? Otherwise, you could cache answers and consider being smarter about when to re-compute any particular answer. Especially if you can use notifications or even a schedule instead of polling to determine when to re-compute. Or wait until the question is asked. Depending on the server, whatever performance numbers you are seeing in your AS AIR app might be irrelevant. Your results may depend on the characteristics of the server. If you have cached answers, a single server could probably deliver the cached answer 1000's of times in a day. If you to compute the answer on a request, this is an area I don't know that well, but I think the server may or may not make it easier to launch a separate process instead of a thread. Finally, you have AS3 code today. It will take learning and time to keep making it faster. IMO, there are several steps you can take. First, AIUI, your AS3 code is compiled into machine code either at build time or at run time depending on the platform and packaging. That's your starting point. The end point would be hand-optimized assembly code. I think your code is currently using Array and things like that. It is theoretically possible to tweak your AS3 code to make the conversion to machine code more and more like the assembly code. I've heard that Vector can convert better than Array. Using local variables can help. Using strong typing every while can also help. The next step might be to learn C++. As Justin says, C++ output often has more overhead than just C, but it is more structured, and you might find it easier to put together the app in C++ by borrowing from existing C++ frameworks, just like we find building apps with the Flex framework more efficient than hand-coding JavaScript. The inside of your functions may look like C anyway if you aren't using framework code in the loop and have cached data from objects in local variables. Some C++ tools let you inject C code. Or you do go and write the whole thing in C. You might find yourself making more silly mistakes, but you should be able to eliminate C++ overhead. And finally, you write the whole thing or at least critical code in assembly. I don't have any particular recommendations other than taking time to truly understand your problem. I've written x86 assembly many years ago as well as C and C++ and, of course, AS so I've worked at all levels. Going all the way to assembly is not recommended for most folks. My 2 cents, -Alex
