옳은 길로 바르게

  • 홈
  • 태그
  • 방명록

2025/10/11 1

Is ++i better than i++?

Assuming that prefix and postfix operations perform the same computation,++i is generally more efficient than i++ in terms of cost.Since i++ requires storing the original value in a temporary register, ++i is slightly cheaper.++i add rax, 1 ; i = i + 1i++ mov rcx, rax ; old = i (temporary value) add rax, 1 ; i = i + 1 (original value)

Programming Language/cpp 2025.10.11
이전
1
다음
더보기
프로필사진

옳은 길로 바르게

sgwin 님의 블로그 입니다.

  • 분류 전체보기 (5)
    • Programming Language (3)
      • cpp (3)
    • Algorithm & PS (2)
      • Algorithm (2)
    • AI & ML (0)
      • Papers (0)

Tag

CPP, C++ algorithm, binarysearch, binarySearch in Cpp, binarySearch in C++, prefix, cpp algorithm, C++, postfix, register cost,

최근글과 인기글

  • 최근글
  • 인기글

최근댓글

공지사항

페이스북 트위터 플러그인

  • Facebook
  • Twitter

Archives

Calendar

«   2025/10   »
일 월 화 수 목 금 토
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

방문자수Total

  • Today :
  • Yesterday :

Copyright © AXZ Corp. All rights reserved.

티스토리툴바