-
Content Count
3710 -
Joined
-
Last visited
-
Days Won
185
Posts posted by David Heffernan
-
-
4 minutes ago, Mark- said:> Yes, I can't keep developing the package without some income.
No, I am purchasing a product (as is), not funding your future work.
> But if you had read a bit further it says:
I read the complete page.
Why should I be forced to take steps to end a subscription I did not want?
Why not have a checkbox, when ordering, to provide for a subscription verse forcing a subscription?
If you don't like the terms, don't buy the product. We all have a right to set the terms of any products that we sell.
-
1
-
-
Open array of record, using a function or record constructor to populate new instances of that record.
Syntax support for initialization is a bit crappy in Delphi sadly.
-
1
-
-
2 hours ago, Lars Fosdal said:I am curious - when would you need such minuscule intervals?
The question literally asks about intervals less than that which you obtakn with a timer. You'll find that Sleep has the same performance as a timer.
-
51 minutes ago, Lars Fosdal said:Is there mathematical proof for that?
Strange way round. Wouldn't it be normal for you to prove your prime claim?
-
1
-
-
22 hours ago, Lars Fosdal said:My first thought was - why not use a thread with sleep if you need that fast a timer - but - again, multithreading raises its own issues.
Try timing Sleep(1) with TStopwatch.
-
10 hours ago, Lars Fosdal said:Personally, I do actually set the capacity to a prime, but I am not quite sure if it because it is sound advice or if it is a cargo cult thing.
The latter.
-
2 hours ago, vfbb said:But the optimization of creating it with the capacity is valid considering that the performance increases is on average 30%, both for small collections and for large ones.
I'm not suggesting that you don't preallocate with a sensible capacity if you know it. I would always do that. In multithreaded code especially, minimising heap allocation is always advisable.
-
Ofc, you don't have to use the RTL dictionary. The spring4d dictionary has a number of powerful features.
I don't think the growth is such an issue. Collisions can be, and better hash and proving would help. The issue for small collections is simply the constant of proportionality. O(1) can be slower than O(log n) for small enough n.
-
2 hours ago, Clément said:
When you need a lookup structure, TDictionary is the way to go as it's always O(1).
Not so simple. For small collections the dictionary can be slower.
-
1
-
-
There is transparency at the pixel level. PNGs have an alpha channel for that.
-
In general you can't do this. Anti-aliasing requires knowledge of the background at the point where the text is rendered. If the original background is a single colour then it may be possible, but will require clever processing. What you ought to do is simply render the text again on the new background.
-
1
-
-
PPL is a library too. It's also quite big. Why does it matter how big a library is?
It would seem odd to me that there would be no problem using a library known to have many defects still, over a high quality library. Who in their right mind would choose the lower quality library facing this choice?
-
2
-
-
1 minute ago, Sherlock said:Good code needs no comments, it is self explanatory
I find this to be a very apt principle.
-
Much of the development I do is refactoring. Not for its own sake, but to enable a new development. Typically this means refactoring existing code, relying heavily on the testing of that code, so that the new development can be added easily. Often the bulk of the time is spent refactoring and then the new development is trivial.
In other words, even when code is well factored, it often needs to be refactored.
Also, its not at all the case that replacing standalone functions with classes always makes your code better. Don't be afraid to have standalone functions if that is the right design.
-
3
-
2
-
-
32 minutes ago, FredS said:Timers are event driven. You are suggesting polling. That's no good.
-
Why is OTL overkill, and PPL is not?
-
-
Imagine how fast it would be if you wrote code that didn't stress the heap allocator. That's the real route to performance.
Real world benchmarks are the only ones that matter.
-
1
-
-
They all do different things. Rather than have us explain this, did you read the documentation?
I don't think that item 3 is very widely used. However meta classes, item 2, is widely used. Classic example is the streaming framework. It is used when you need to instantiate a class whose identity is only known at runtime. When streaming properties the framework reads the class name, looks it up using RTTI and then uses meta classes to instantiate the instance if that dynamically determined type. Always seen with virtual constructors.
-
1
-
-
4 hours ago, RDP1974 said:should be cool to have a lock-free allocator using threadvar and/or TLS API
Threadvar is implemented on top of TLS on Windows.
How is lock free going to handle deallocations made from a different thread from that which allocated the memory?
But hey, if you want to write this code, go for it.
-
All UI happens from the UI thread. So if you want an exception from another thread to result in UI, you need to marshal it into the main thread.
Having madExcept in your process is great. But there are a class of exceptions that you don't want to trouble the user with a bug report. I call these expected exceptions. You need to decide on a policy for those exceptions.
-
GetIt, I just don't get it. Surely you are better off pulling from the repo?
-
1
-
-
This is one of the reasons why the cool cats don't use RTL collections
-
Cross process window parenting relationships never end well. Don't try this.
https://devblogs.microsoft.com/oldnewthing/20130412-00/?p=4683
-
2
-
pre-generic dictionary class
in Algorithms, Data Structures and Class Design
Posted · Edited by David Heffernan
Expand a generic dictionary implementation manually. Just replace the TKey and TValue textually.
It would also be very valid to stop developing GExperts for pre generic delphi.