Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21

Thread: Access speeds in assembly

  1. #11
    Join Date
    Mar 2005
    Beans
    947
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Access speeds in assembly

    Quote Originally Posted by cszikszoy View Post
    Furthermore, to the OP, you'll find a lot of people here that don't like or don't know how to really use ASM because python & the like are generally what's accepted and used in this forum. Speak to someone outside the Computer Science realm and you'll see that ASM is incredibly useful, and incredibly powerful.
    Oh, please. There's a very narrow range of applications for which ASM is still appropriate.

    I've spent a lot of time counting cycles. In retrospect, I think most of that time was wasted.

  2. #12
    Join Date
    Jun 2009
    Location
    0000:0400
    Beans
    Hidden!

    Re: Access speeds in assembly

    Quote Originally Posted by Can+~ View Post
    Don't get me wrong, I also learnt Assembly for pretty much the same reasons, plus giving you a more deeper view on the Programming Abstractions as a system. The thing is that I never sought for ultimate speed, because I knew that this problem is already solved by a compiler+assembler, and it's underlying optimizations.
    Ahh, but a compiler won't give you a more efficient program if you used a heap sort when a shell sort or a quicksort would have been better. If you scale that sort of optimization down to an assembly level, that's really what I'm looking to accomplish. Perhaps I'm going about it the wrong way?

    Quote Originally Posted by Can+~ View Post
    I wonder what Freud would've said about that.
    I'm sure almost any psychologist would have a field day with me.

  3. #13
    Join Date
    Nov 2007
    Beans
    410
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Access speeds in assembly

    Quote Originally Posted by wmcbrine View Post
    Oh, please. There's a very narrow range of applications for which ASM is still appropriate.
    Sure, in your industry / line of work. But as I've stated, it's not in mine (and many others).

  4. #14
    Join Date
    Aug 2007
    Location
    127.0.0.1
    Beans
    1,800
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Access speeds in assembly

    Quote Originally Posted by falconindy View Post
    Ahh, but a compiler won't give you a more efficient program if you used a heap sort when a shell sort or a quicksort would have been better.
    And it isn't supposed to. That wasn't my point, at all. The boring things about instructions are managed by the compiler, choosing the correct algorithm and/or data structure is what makes your code better, independent of the programming language.

    Quote Originally Posted by falconindy View Post
    If you scale that sort of optimization down to an assembly level, that's really what I'm looking to accomplish. Perhaps I'm going about it the wrong way?
    Not sure about that. In my mind, I picture that once you have everything up in memory, however it gets processed won't matter, or if it does, it will be minimal using the same algorithm.

    This kinda remind me of the gentoo crowd.

    But more importantly, it reminds me of myself. I used to be the "DIY" kid. If I wanted a linked list, I would code it myself, to get a specialized list, that does what I want, and does it optimal for my solution.

    But then again, the solution I built is "too specific", later I find myself wanting to have a more generic list, a list that can do other things, so I code them accordingly, and end up having a completely generic list.

    On the process of having a generic list, I dumped everything that made the list specialized, therefore, I removed the single advantage I thought I would gain by making my own list.

    And this is nothing wrong, abstractions exist for a reason, someone, somewhere, realized that a single problem was repeating way too much, so decided that he would do a generic solution trying to satisfy every possible scenario, therefore, providing a solution to the problem and creating a more abstract construct.

    A set of abstract constructs that can speak to each other on the same level (for instance, not going lower, eg. Imagine that a java function suddenly wants a int *pointer, it would break the abstraction layer). Then the whole abstraction shifts to a higher one.

    Your idea of moving algorithms to lower level languages is not wrong, but the whole point of Programming languages is that they build a layer on top of an older one, being the most basic one, the hardware. So pushing algorithms closest to hardware, implies a gain in speed, but a decrement in genericness, and losing touch with higher-level interfaces that would probably make a better use of said functions on the long run.

    And how do I know this much about abstractions? Or where this theory comes? From the Systems Theory. I embraced the Hollistic viewpoint of things.
    "Just in terms of allocation of time resources, religion is not very efficient. There's a lot more I could be doing on a Sunday morning."
    -Bill Gates

  5. #15
    Join Date
    Feb 2007
    Location
    Tuxland
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Access speeds in assembly

    GCC is basically a dude with a long UNIX beard. He has an expert knowledge of the internals of modern CPUs. He has been studying assembly optimization for years. And he lets you write code in C and he will put his expertise to work for you hand optimizing all that C code into very performant assembly code.
    Proud GNU/Linux zealot and lover of penguins
    "Value your freedom or you will lose it, teaches history." --Richard Stallman

  6. #16
    Join Date
    Jan 2008
    Beans
    4,757

    Re: Access speeds in assembly

    Quote Originally Posted by phrostbyte View Post
    GCC is basically a dude with a long UNIX beard. He has an expert knowledge of the internals of modern CPUs. He has been studying assembly optimization for years. And he lets you write code in C and he will put his expertise to work for you hand optimizing all that C code into very performant assembly code.
    ... and yet the Intel C Compiler is far most adept at optimising for the Intel Architechtures.

    Even then, autogenerated assembly still isn't good enough, as there will always be unneeded instructions put in place.

    Regards
    Iain

  7. #17
    Join Date
    Feb 2007
    Location
    Tuxland
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Access speeds in assembly

    Quote Originally Posted by tinivole View Post
    ... and yet the Intel C Compiler is far most adept at optimising for the Intel Architechtures.

    Even then, autogenerated assembly still isn't good enough, as there will always be unneeded instructions put in place.

    Regards
    Iain
    Yes, the Intel compiler is more likely to spontaneously use SIMD instructions via auto-vectorization. GCC 4.4 has much improved in this regard.. I think if you will benchmark GCC against Intel's compiler suite you might be surprised.

    Regardless I believe there are very few places where a programmer even one needing to do optimization will ever need to write assembly.

    There exists libraries such as AMD's Math Library, or Intel's performance primitives, which are written with extremely optimized assembly routines and cover a wide scope of mathematical algorithmic primitives. Open source libraries like FFWT or the GNU Scientific Library are similar.

    These numerical libraries or GNU/Intel compilers are written by experts who understand processor optimization very well. It's unlikely unless you too are an expert that you will outdo them.

    As long as you write in C or Python improvements to the tooling will ensure your programs can continue to run faster. Can you say the same for assembly?

    Look at PyPy or unladen-swallow: completely unmodified Python programs run faster. I believe that because you have richer metadata. In theory you have more to work with, for optimization. I believe in 10-20 years from now people might be rewriting their assembly routines in Python or Ruby for optimization purposes.
    Last edited by phrostbyte; October 5th, 2009 at 07:46 AM.
    Proud GNU/Linux zealot and lover of penguins
    "Value your freedom or you will lose it, teaches history." --Richard Stallman

  8. #18
    Join Date
    Aug 2009
    Beans
    Hidden!

    Re: Access speeds in assembly

    At first one little note: assembly is mainly useful in order to understand how computer works(which is a must if one wants to call himself/herself programmer), after that one can always use "asm" block in C/C++ if needed

    About the stack, well it's FILO, but you can access everything with SP+value(assuming resulting address is valid), and one need to managed SP(and in general different architecture have a different understanding of it). Btw, biggest reason that Macs where platform of choice for every musician - it was simply faster and better, most notably PPC has a lot more registers

    There's also something called compiler intrinsics which let programmer tell to "everything" knowing compiler that in some places...well, compilers just sucks and better left the job done by human(after all only person who write the program knows that algorithm need cache flush at specific time in order to be useful).

    P.S. I'm amazed how thread about assembly start to not have anything to do with assembly, but more with other languages... come on! If you don't know something about the topic stop flooding and make another thread about abstractions and is it useful and when!
    P({})

  9. #19
    Join Date
    Jun 2009
    Location
    0000:0400
    Beans
    Hidden!

    Re: Access speeds in assembly

    Quote Originally Posted by Can+~ View Post
    And it isn't supposed to. That wasn't my point, at all. The boring things about instructions are managed by the compiler, choosing the correct algorithm and/or data structure is what makes your code better, independent of the programming language.
    That's all I'm trying to do.

    Quote Originally Posted by Can+~ View Post
    This kinda remind me of the gentoo crowd.
    I may have seen that before, but I still laughed out loud this time.

    Quote Originally Posted by Can+~ View Post
    Your idea of moving algorithms to lower level languages is not wrong, but the whole point of Programming languages is that they build a layer on top of an older one, being the most basic one, the hardware. So pushing algorithms closest to hardware, implies a gain in speed, but a decrement in genericness, and losing touch with higher-level interfaces that would probably make a better use of said functions on the long run.
    Well put.

    Quote Originally Posted by grayrainbow
    P.S. I'm amazed how thread about assembly start to not have anything to do with assembly, but more with other languages... come on! If you don't know something about the topic stop flooding and make another thread about abstractions and is it useful and when!
    Assembly is intrinsic to a better understanding of other languages. It's only natural that almost any thread about assembly gets derailed. My initial question was answered already anyways.

  10. #20
    Join Date
    Jan 2009
    Location
    Maryland, USA
    Beans
    242
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: Access speeds in assembly

    Quote Originally Posted by falconindy View Post
    (much to my dismay using MASM)
    JWasm is is a MASM clone that runs in linux. Haven't tried it though...

Page 2 of 3 FirstFirst 123 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •