Jump to content

Anders Melander

Members
  • Content Count

    2854
  • Joined

  • Last visited

  • Days Won

    156

Posts posted by Anders Melander


  1. 10 minutes ago, Jud said:

    Well, I used to be able to get to 100% usage, now I can't get 50%

    My old car consumed 7 liters of diesel per 100 km. The new one only uses 3.5 liters of diesel per 100 km. There must be something wrong with the engine...

     

    If your whole system was 100% CPU bound, and able to utilize all cores without any contention, then there would be something to talk about - but it isn't. There's also RAM, disk, bus and controller performance to take into account.

    As we have tried to explain, you need to look at the amount of work being done and not the CPU %.

     

    You can use the system performance monitor if you really want to find out what your system is doing and what, if anything, is preventing it from running at 100% CPU. But you will have to read up on a lot system internals in order to know what to look at and how to interpret the data.

     

    20 minutes ago, Jud said:

    I used to be able to use 98% +.

    Doing what exactly?


  2. 3 minutes ago, Alberto Paganini said:

    The preinstalled Windows is definitely, a customised version.

    A customized Windows from China (if that's where the system is from)... That right there would be enough for me to wipe it.

     

    6 minutes ago, Alberto Paganini said:

    Why are you avoiding Amazon these days ?

    I can't speak for Lars, but before Space Karen took the title, I Bezos was a bit of a real life Bond villain (okay he still is, but it's nothing compared to Elon). There are still a lot of ethical problems with how Amazon treat their work force and their suppliers. And then there's the recent Washington Post debacle. These idiots just can't stay likable.

    That said, Amazon's return policy and customer service is second to none and it's the only place where I can get English language books in hardcover for a reasonable price (I'm in Denmark).

     

    13 minutes ago, Alberto Paganini said:

    I wish I had the knowledge and confidence to do that, Anders. At the first hurdle, I would not be able to progress.

    Fair enough but like everything else (except maybe death), the only way to overcome that is to try it and learn from the experience. But I can understand if you'd rather use your time and energy on something else.

    I think the last system I bought ready-made, apart from laptops, had a 80386 processor and 16Mb RAM. I've built a few lemons along the way but it's been a while since the last one.

     

    By the way, one thing that you should do when looking at a new system is compare the CPU with the one in your existing system. Although a new system most likely has a newer CPU it might not be faster than what you have now. For example the processors in the two systems you listed are mobile processors optimized for low power consumption (it has a nominal clock speed of 0.7 GHz!), while your existing system likely has a desktop processor which likely is optimized for performance.

    https://www.cpubenchmark.net/cpu.php?cpu=Intel+N100&id=5157

    • Like 3

  3. 1 hour ago, Olli73 said:

    Maybe the cores get too hot and so gets throttled...

    Throttling makes the CPU run slower, not run less.

     

    2 hours ago, Jud said:

    What caused this loss in performance

    You can't measure performance by looking at the task manager. Measure the amount of work being done instead.

    • Like 2

  4. 1 minute ago, Anders Melander said:

    TextToShortCut(S)

    TextToShortcut is the problem here, if you can call it that. It compares the shortcut text against some resourcestrings ("Shift+", "Ctrl+", etc.) and if those resourcestrings have been translated then the shortcut strings must also be translated.

     

    As far as I can tell (contrary to what I claimed above), if the OP isn't translating anything, then there should be no problem. I would test to make sure, though.

    • Thanks 1

  5. 6 minutes ago, Lajos Juhász said:

    According to the documentation the object property of the stringlist is used to handle the shortcuts not the text version

    The text is what get stored in the DFM. The actual shortcut is created from that and stored at run-time in the Objects pointer list:

    function TShortCutList.Add(const S: String): Integer;
    begin
      Result := inherited Add(S);
      Objects[Result] := TObject(TextToShortCut(S));
    end;

     


  6. Secondary shortcuts are stored as strings in a TStringList so if whatever translation tool you are using supports TStringList then it can be localized.

     

    edit: I can see that the SO post you linked already explains all this and it wasn't what you asked about. My guess is that, yes, if the users locale is German then English shortcuts won't work. It pretty easy to test for your self; Just change the UI language in Windows.


  7. 14 hours ago, Alberto Paganini said:

    I am thinking of buying a mini PC and installing Delphi CE. I chose the mini PC mainly because of its small footprint.

    This might sound crazy, but hear me out 🙂

    1. Buy:
      • A nice Mini-PC mainboard with integrated graphics.
      • A CPU, some RAM, NVMe SSD.
      • The smallest fanless PSU that meets the power requirements of the above.
    2. Put it all in cardboard box (or whatever). Remember to make some holes for airflow.
    3. Profit!

    You can do this really cheap and I can testify, from personal experience, that it is a possible setup. I once worked on a system a bit like this for six months. I didn't implement the luxury version with the cardboard box though. Instead I just placed the mainboard (which was full AT size) on a wooden breadboard and bolted all the components to it. Why did I do this, you ask? Well, my wife had a meltdown over something related to time spent with her vs. time coding (Women, pfft! 🙄 Amiright?) and completely smashed my full tower case with a rolling pin, I shit you not.

     

    Anyway, of course you still have to decide on the specs for the components but you will have to figure that out for yourself. It's impossible to give any clear recommendations as the specs will depend on what and how you use the system. Just get the best you can within your budget.

    • Thanks 1
    • Haha 3

  8. 25 minutes ago, uligerhardt said:

    XE6 in the meantime

    Okay, so I would recommend that you simply start with the RTL TThread. Mainly because it appears that you have no prior threading experience (or you probably wouldn't have asked in the first place) and it would be best to learn the basics before trying something more advanced. Threading might seem easy but it's actually really difficult if you don't know and understand the many things that can go wrong.

     

    I would also avoid the various 3rd party threading libraries, even though I'm sure they can do some nice things, so you don't introduce external dependencies and get locked in to their way of doing things. Once you know a bit more you can make an educated decision about which way to go.

     

    The PPL was introduced in XE7 but I think it took a while for it to become reliable(ish). I stayed clear of all the versions between XE2 and Delphi 10 so I don't have first-hand experience with those versions. These days I seldom use TThread directly. Most of my thread tasks are short lived so they benefit from the TTask thread pool (and TTask is just so much nicer to use).


  9. 13 hours ago, Remy Lebeau said:

    You can't.

    To be clear: You can insert a stream of pre- and postfix bytes by declaring pure asm functions containing these bytes just before and after the function. You just just can't control the exact offset of them. The compiler is free to place them anywhere (it doesn't) and it's free to take alignment into account when placing them (which it does).

     

    For example this code:

    procedure Prefix;
    asm
      db $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f
    end;
    
    procedure Test;
    begin
      WriteLn('Hello world');
    end;
    
    procedure Postfix;
    asm
      db $11, $12, $13, $14, $15, $16, $17, $18, $19, $1a, $1b, $1c, $1d, $1e, $1f
    end;
    
    begin
      // Dummy references to ensure prefix/postfix procs get linked in
      if (@Prefix <> @Postfix) then
        Test;
    end.

    is compiled to this:

    Project46.dpr.9: db $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f
    00000000009BEEF0 0102030405060708090A0B0C0D0E0F
    Project46.dpr.10: end;
    00000000009BEEFF C3               ret
    00000000009BEF00 <...junk...>
    
    Project46.dpr.13: begin
    00000000009BEF00 55               push rbp
    00000000009BEF01 4883EC20         sub rsp,$20
    00000000009BEF05 488BEC           mov rbp,rsp
    Project46.dpr.14: WriteLn('Hello world');
    00000000009BEF08 488B0DB1310000   mov rcx,[rel $000031b1]
    00000000009BEF0F 488D1526000000   lea rdx,[rel $00000026]
    00000000009BEF16 E8B573FFFF       call @Write0UString
    00000000009BEF1B 4889C1           mov rcx,rax
    00000000009BEF1E E80D75FFFF       call @WriteLn
    00000000009BEF23 E8E85FFFFF       call @_IOTest
    Project46.dpr.15: end;
    00000000009BEF28 488D6520         lea rsp,[rbp+$20]
    00000000009BEF2C 5D               pop rbp
    00000000009BEF2D C3               ret
    
    00000000009BEF2E <...junk...>
    Project46.dpr.19: db $11, $12, $13, $14, $15, $16, $17, $18, $19, $1a, $1b, $1c, $1d, $1e, $1f
    00000000009BEF60 1112131415161718191A1B1C1D1E1F
    Project46.dpr.20: end;
    00000000009BEF6F C3               ret

     

    The problem here is the <...junk...> it inserts to maintain alignment. If you are really desperate it should be possible to take this into account and, given the offset of the pre- and postfix markers, find the actual start and end of the function if that is what you're after.


  10. 1 minute ago, Uwe Raabe said:

    Probably because at that time pointers were still 32 bit only.

    The point was that since it was originally (refs "to begin with") declared as an integer, not a nativeint, the original intent obviously wasn't that it could be used for pointers. It just so happened that it could.


  11. FWIW, I once, as an experiment, implemented string interning using a dictionary in an application that contained hundred of thousands of strings with about 75% duplicates. It was a 32-bit application which was hitting the 4Gb limit and running out of memory.

    Sure, it saved a few hundred megabytes but the overhead of the dictionary lookup completely killed the performance.

     

    With 64-bit and virtual memory I can't see any reason at all to do this exerciser.

×