Quote:
Originally Posted by
FunkyDexter
I guess I'm saying, our job is primarily to make something work. But it's also, secondarily, to make something work better.
Thanks FunkyDexter,
If I were working on something I proposed to publish I would have to take all that into consideration,
as it happens I program for fun, and the little applications I embark upon are mostly for my own use,
a few find their way onto my wife's computer, and one or two even find their way onto my son's.
Quote:
dbasnett
To show how our solutions worked we had to create some data to go along with our answers, so a few lines was out of the question.
Thanks Dbasnett, I understand that, I just didn't
expect it.
Quote:
Sitten Spynne
In order to separate the values we have choices. Suppose we use Split():
Split() has to iterate the string to find the index of each '|', then make a break. So that's 16 steps for iteration, and it has to create 20 bytes of String for the name and 10 bytes worth of String for the integer.
Getting the string is one step.
Getting the integer uses parsing, so we have to allocate 4 bytes for the Integer and perform 15 steps for the parsing.
For the string, we're using 32 bytes initially. To get the two values consumes another 34 bytes and takes 32 steps.
The 64 bytes the String uses is 3x what the class uses, and can get even worse. The 32 steps it uses are 16x the 2 steps the class uses, and can get even worse. Those steps translate to CPU cycles, which waste both your user's time and battery. That's why I say it's bad.
Thanks Sitten Spynne,
That's certainly an eye-opener.
"Suppose we use Split():"
Out of curiosity, and since the first element is always an integer, suppose we use: -
Code:
Sub Get_em(ByVal WrdIn As String)
Dim Num As Integer, Wrd As String
Num = Val(WrdIn)
Wrd = WrdIn.Substring(InStr("|"))
End Sub.
(yeah I know it doesn't go anywhere)
Would that cost us more or less ?
(If you have the time to think about it)
Quote:
kaliman
It feels like the OP is not really asking for an answer but validation that his horrible solution is OK. Just give him that.
Use a pipe divider Poppa, its OK.
Thanks for the kind thought Kaliman, nice of you.
(OP = Old Person ?)
Quote:
Sitten Spynne
I want to remember this post as something I hope I never say about another person to their face again. I want Poppa to feel smart and big. Not dumb and small. We can't get there if I patronize him. He might still disagree with me. That's fine. I've been posting on programming forums for 10 years. If that happens, he'll be back later, with a problem he can't solve with formatted strings. And then he'll be enlightened. Or he won't. I choose to spend my time here, and he's not the only person reading the thread.
Thanks again Sitten Spynne,
When I'm bored and need something interesting to do, I usually open VB Forums.
(It's my belief that this forum used to be called 'VB Wire' ?)
I take a look at all the
unanswered threads, if I think I can suggest something, I 'take my ass in my hand' and give it a shot...
If subsequently my suggestion gets shot down, well at least there's been at least one proposed solution, if it means they're able to continue with their project until something better comes along, all well and good. After all, surely a working answer is better than no answer at all.
Thank you all for your time and patience...
Poppa.