-
mmf 2 is silt! - calculations per second
I created a program that calculates and displays certain number of all possible combinations. Unfortunately, with 6 variables and 14 figures MMF are calculated tragically slow.
For example, I created the same program in C + +
and here is the result:
MMF2Dev - 1000 fps (max) - 1000 calculations per second - about 2.5 hours (with luck)
C + + app - fps X (possibly computer) - X calculations - about one/two seconds
And now my question:
Does the mmf is impossible to calculate faster than a 1 calculation / millisecond?
-
Re: mmf 2 is silt! - calculations per second
-
Re: mmf 2 is silt! - calculations per second
It sounds like you would benefit from using fastloops to perform these calculations, so you're not waiting for the event list to roll around again once the frame is updated.
-
Re: mmf 2 is silt! - calculations per second
Also, it is bound to be slower as it is interpreted not compiled.
What problem exactly are you trying to solve?
-
Re: mmf 2 is silt! - calculations per second
Quote:
Originally Posted by Jax
Also, it is bound to be slower as it is interpreted not compiled.
But the overhead of this won't be enough to turn 2 seconds into 2.5 hours. His events must be very poorly structured.
-
Re: mmf 2 is silt! - calculations per second
No true, I just mean that overall you probably shouldn't be doing brute force things in MMF.
-
Re: mmf 2 is silt! - calculations per second
He is only doing 1 calculation per MMF frame, my bet in an always event.
OP what you need to do is a fastloop, see below.
+ Start of frame
- start loop "calculate" -1 times
+ OnLoop("calculate")
- do calculations here
+ OnLoop("calculate")
+ result has been found
- Stop Loop "calculate"
-
Re: mmf 2 is silt! - calculations per second
I tried also with fastloop. Unfortunately, mmf hangs (no response). When using fastloops mmf overlooks some calculations: for example, would need to calculate 5 234 761 and the calculation is calculated, eg 4 835 332 (for here is talking about large numbers and not 1000 or 2000) if not completely mmf crashes.
during each loop, the program must calculate some figures and classify them in the list of results by using the "string parser obiect". at this point sort takes place only in 20%
-
Re: mmf 2 is silt! - calculations per second
If you are using anything like List object then that is Windows' fault because it tries to redraw objects like List and Edit every time they have a change.
-
Re: mmf 2 is silt! - calculations per second
I've made a program that can calculate expressions up to 16 decimal places, do any Sqrt() etc command, x, /, +, -, etc, and it barely takes a second.
Although admittedly it's around 4 layers of loops and located in an AI program.
-
Re: mmf 2 is silt! - calculations per second
try to do something like this for yourself:
40 different numbers on the list, 8 numbers of components (eg 234 + 1534 + 3456 +...+...+...+...+...) course, the program is to calculate all possible combinations of numbers for 8 of the 40 (Just add these numbers) in addition to a separate list notes the results of all combinations is exactly the sum of: 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000th
but I propose to use Newton's formula to even know how many of these loops to be. (The formula for the number of combinations)
It's just part of the task should execute the program at a loop.
Programs written in C + + do it without a problem
-
Re: mmf 2 is silt! - calculations per second
The number of loops should not cause crashes on mmf. I would say its something to do with your events, or you are using a windows object as mentioned by LB which causes massive slowdown.
Maybe you should upload an example so we can check it out?
-
Re: mmf 2 is silt! - calculations per second
-
Re: mmf 2 is silt! - calculations per second
Here is example with some events of my app (version using loops)
http://easy-site.pl/appz/examples/slit example.mfa
-
Re: mmf 2 is silt! - calculations per second
Your application is asking for 6 trillion (6,000,000,000,000) loops without slowdown?
Sure C++ can do it because theres no GUI.
It's most likely the 'add line to your results list box' that is slowing it down. Constantly modifying an input box causes slows downs... you could add to an array and output it at the end, but I still have no idea how you wouldn't cause a delay with 6,000,000,000,000 loops.
If you use an LUA extension you'd get better speeds, but I doubt theres a program that can add trillion of items to a list box without slowdown.
Out of curiousity, of the six trillion loops, what percentage is likely to add to the list box?
-
Re: mmf 2 is silt! - calculations per second
You can do this with 'just' 76,904,685 loops.
-
Re: mmf 2 is silt! - calculations per second
Right, well what you are doing is stupid anyway as 40^8 > 32^8 = (2^5)^8 = 2^40 > 2^32, so you can't even use an index variable to loop that high so you obviously can't do it that way.
Second, you are using order 8-tuples instead of unordered 8-tuples, despite it being an unordered problem. And even that is a fairly inefficient way of doing it compared to what you could do but at least it'd be easily solvable.
The other thing is: Did you actually write the C++ version? If you tried to write this in C++ it still wouldn't run fast. In fact, I tested just running your loop with incrementing a variable inside and it definitely doesn't run for a couple of seconds. So I'm thinking that the C++ code is either not working properly, or it is written differently.
A simple C++ program will run much faster as the processor can predict what is going to happen a lot easier compared to in MMF, and so there will be massive changes. But in this case, I think it is your approach that is wrong.
-
Re: mmf 2 is silt! - calculations per second
Maybe not "stupid", but improper?
Marv
-
Re: mmf 2 is silt! - calculations per second
Application I created to test the mmf. And not in order to assess whether it is stupid or not.
I am concerned about one more thing: If during the loop, has a lot of things happen, mmf some skips . or retrieves these values are not what you need. I think that this is due to delay. And it looks like this:
+ On loop
- Add 1 to the Global A
+ On loop
+ Global A> 549
+ Global A <551
- Set a line (list object) is a Global A / / / And mmf write: 558
-
Re: mmf 2 is silt! - calculations per second
Here is the thing: You cannot do what you are doing in C++ in decent time. I ran my test program for an hour and it didn't complete, and that did less than your program would have to do.
So the problem is with your program technique and not with MMF.
Do you want help being more efficient then? Also, are the 40 numbers input specified by the user or do you know them before hand? Also, are they unique or can there be duplicates?
-
Re: mmf 2 is silt! - calculations per second
I threw your loop example into MMF and it worked as expected for me... if you're seeing '558' instead, could you upload a file that demonstrates the problem?
-
Re: mmf 2 is silt! - calculations per second
look at this example:
http://easy-site.pl/appz/examples/tst.mfa
-
Re: mmf 2 is silt! - calculations per second
Hey EasySite,
First, just looking over my earlier posts they seem a bit rude. Sorry, I didn't mean it quite as it sounded I think. So sorry about that!
However, your question inspired me, because I don't think this is a very easy thing to do in MMF. For MMF1.5 I wrote a set object, although it didn't allow you to generate subsets. I've started making a new set object (well, a list object). It is absolutely no-where near complete, and there is lot else I want to do with it, but a very early version is with the zip below.
The reason is that using it, the example can be done in less than 3 seconds and with a lot less code.
I've also written it with the thought in mind that we should not be converting between numbers and strings, so if you add something as a number it really will stay as it internally (although it will convert into a string when necessary, and anything input as a string will be interpreted as a number when required too).
Anyway, here it is
-
Re: mmf 2 is silt! - calculations per second
MMF exchanges raw power and efficiency in favor of ease of use and faster creation time- this is the exchange made with virtually *all* higher level languages- all abstractions.
However, while MMF will always have an overhead associated with its processing and event structure, by understanding the mechanics of what is going on, and how to manipulate the time complexity of your events and format your code properly, you can easily create applications that seem to do amazing things- despite running in MMF2.
For example, my current engine runs at 50 FPS without a skip on my machine, yet it includes an array that saves over 1 megabyte per second in data in 50 MB of RAM, parsing and interpreting string based custom events, rotating the entire screen display to an angle, and iterating a complicated AI over every enemy in the frame. One look at the code and you'd probably understand how its possible- its very well grouped, commented and uses numerous tricks to make it possible.
There comes a point where its less efficient to make a project in a 'more efficient' language- simply because it takes so much more time to create than the time it saves when it processes. If Malbolge was 10x more efficient than C++, people still wouldn't use it.
But if you study the mechanisms of the object scope list, event parsing and grouping, and how to reduce the time complexity of loops- it should be possible to do virtually *anything* in MMF2 that you could do in any 2D application. Its Turing-Complete, after all >_>
-
Re: mmf 2 is silt! - calculations per second
Very well said, Pixel Thief. :)