emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: State of the overlay tree branch?


From: Sebastian Sturm
Subject: Re: State of the overlay tree branch?
Date: Wed, 21 Mar 2018 01:36:38 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

> So it's still a mystery why your original file produces such a large
> slowdown with overlays.
>
> Can you show the results of "M-x profiler-report" for the slow test
> with your original source file?  It could have some clues.  If that's
> impossible, I can only repeat my suggestion to use perf to find the
> code in Emacs that takes the lion's share of the processing time.

this is the profiler report I get for the slow case (BTW, is there a way to have the profiler resolve functions within line-number-at-pos? I tried increasing profiler-max-stack-depth to 32, but the profiler still didn't show anything below line-number-at-pos)

- command-execute                                               20522  97%
 - call-interactively                                           20522  97%
  - funcall-interactively                                       20061  94%
   - eval-expression                                            18609  87%
    - eval                                                      18609  87%
     - benchmark-often                                          18609  87%
      - let*                                                    18609  87%
       - while                                                  18609  87%
        - message                                               18388  86%
         - format                                               18376  86%
          - nth                                                 18376  86%
           - let                                                18376  86%
            - list                                              18376  86%
             - let                                              18368  86%
                line-number-at-pos                              18348  86%
           ws-butler-after-change                                   4   0%
   + evil-open-below                                              614   2%
   + counsel-M-x                                                  575   2%
   + undo-tree-undo                                                79   0%
   + next-line                                                     68   0%
   + evil-normal-state                                             52   0%
   + evil-previous-line                                            48   0%
   + previous-line                                                  7   0%
   + evil-emacs-state                                               6   0%
   + evil-insert                                                    3   0%
  + byte-code                                                     461   2%
+ redisplay_internal (C function)                                 254   1%
+ timer-event-handler                                             116   0%
+ evil-escape-pre-command-hook                                     82   0%
+ ...                                                              63   0%
+ global-spacemacs-whitespace-cleanup-mode-check-buffers 47 0%
+ yas--post-command-handler                                        33   0%
+ evil-repeat-post-hook                                             6   0%
+ evil-visual-post-command                                          5   0%
+ flycheck-handle-signal                                            4   0%
  evil-snipe-mode-check-buffers                                     4   0%
  global-undo-tree-mode-check-buffers                               4   0%
+ sp--save-pre-command-state                                        2   0%
+ xselect-convert-to-string                                         2   0%
+ evil-visual-pre-command                                           1   0%
+ flycheck-pos-tip-hide-messages                                    1   0%
+ which-key--hide-popup                                             1   0%

with perf, the ("self") time taken by buf_charpos_to_bytepos increases from ~60% (fast case) to >98%. This is the diff generated by perf diff <fast.perf> <slow.perf>:

# Event 'cycles'
#
# Baseline Delta Shared Object Symbol # ........ ....... .................... ..........................................
#
    57.77%  +40.30%  emacs-27.0.50         [.] buf_charpos_to_bytepos
    11.12%  -10.70%  libc-2.23.so          [.] __memrchr
     6.48%   -6.19%  emacs-27.0.50         [.] assq_no_quit
     5.92%   -5.62%  emacs-27.0.50         [.] find_cache_boundary
     4.26%   -4.07%  emacs-27.0.50         [.] set_buffer_internal_2
     4.10%   -3.73%  emacs-27.0.50         [.] find_newline
     3.54%           libc-2.23.so          [.] __memmove_avx_unaligned
     1.25%   -1.19%  emacs-27.0.50         [.] region_cache_forward
     0.46%   -0.41%  [kernel.kallsyms]     [k] 0xffffffff83004eb0
0.26% -0.26% emacs-27.0.50 [.] revalidate_region_cache.isra.1
     0.25%   -0.23%  emacs-27.0.50         [.] find_interval
     0.23%   -0.23%  emacs-27.0.50         [.] swap_in_symval_forwarding
     0.19%   -0.18%  emacs-27.0.50         [.] do_symval_forwarding
     0.16%   -0.15%  emacs-27.0.50         [.] eval_sub
     0.16%   -0.15%  emacs-27.0.50         [.] x_produce_glyphs
     0.13%           libXft.so.2.3.2       [.] XftCharIndex
     0.13%   -0.12%  libXft.so.2.3.2       [.] XftGlyphExtents
     0.12%   -0.12%  emacs-27.0.50         [.] store_symval_forwarding
     0.12%   -0.11%  emacs-27.0.50         [.] exec_byte_code
     0.09%           emacs-27.0.50         [.] Fsymbol_value
     0.08%   -0.08%  emacs-27.0.50         [.] x_get_glyph_overhangs
     0.07%           emacs-27.0.50         [.] find_symbol_value
     0.07%           libc-2.23.so          [.] __memcpy_avx_unaligned
     0.07%           emacs-27.0.50         [.] Fassq
     0.07%           emacs-27.0.50         [.] insert_1_both.part.9
     0.06%           emacs-27.0.50         [.] offset_intervals
     0.06%           libc-2.23.so          [.] __memcmp_sse4_1
     0.06%           emacs-27.0.50         [.] next_element_from_buffer
     0.05%   -0.05%  emacs-27.0.50         [.] move_it_in_display_line_to
     0.05%   -0.04%  emacs-27.0.50         [.] get_next_display_element
     0.05%   -0.04%  libXft.so.2.3.2       [.] XftFontCheckGlyph
     0.05%   -0.04%  libX11.so.6.3.0       [.] _XSetClipRectangles
     0.04%           libc-2.23.so          [.] __GI___printf_fp_l
     0.04%           emacs-27.0.50         [.] styled_format
     0.04%   -0.03%  emacs-27.0.50         [.] xftfont_text_extents
     0.04%   -0.03%  emacs-27.0.50         [.] draw_glyphs
     0.04%           emacs-27.0.50         [.] display_line
     0.04%           emacs-27.0.50         [.] validate_interval_range
     0.04%           emacs-27.0.50         [.] update_window_fringes
     0.04%           libX11.so.6.3.0       [.] 0x000000000001b65a
     0.04%   -0.03%  emacs-27.0.50         [.] lookup_char_property
     0.04%           emacs-27.0.50         [.] balance_an_interval
     0.03%           emacs-27.0.50         [.] composition_compute_stop_pos
     0.03%           libpthread-2.23.so    [.] pthread_mutex_unlock
     0.03%   -0.03%  emacs-27.0.50         [.] x_draw_glyph_string
     0.03%   -0.03%  emacs-27.0.50         [.] mem_insert
     0.03%   -0.03%  libpthread-2.23.so    [.] pthread_mutex_lock
     0.03%           libc-2.23.so          [.] malloc
     0.03%           emacs-27.0.50         [.] update_window_line
     0.03%           emacs-27.0.50         [.] Ffuncall
     0.03%   -0.03%  emacs-27.0.50         [.] get_glyph_face_and_encoding
     0.03%   -0.02%  emacs-27.0.50         [.] set_internal
     0.03%   -0.02%  emacs-27.0.50         [.] update_window
     0.03%           libXft.so.2.3.2       [.] XftDrawSrcPicture
     0.03%           libc-2.23.so          [.] vfprintf
     0.03%   -0.02%  emacs-27.0.50         [.] do_one_unbind.constprop.20
     0.03%           emacs-27.0.50         [.] set_iterator_to_next
     0.02%           emacs-27.0.50         [.] specbind
     0.02%           libc-2.23.so          [.] __memset_avx2
     0.02%   -0.02%  libX11.so.6.3.0       [.] _XFlushGCCache
0.02% emacs-27.0.50 [.] lookup_glyphless_char_display
     0.02%           libc-2.23.so          [.] _int_malloc
     0.02%           emacs-27.0.50         [.] set_cursor_from_row.isra.40
     0.02%   -0.02%  emacs-27.0.50         [.] message_dolog.part.60
     0.02%           emacs-27.0.50         [.] gap_left
     0.02%   -0.02%  emacs-27.0.50         [.] unbind_to
     0.02%   -0.02%  emacs-27.0.50         [.] init_iterator
     0.02%           emacs-27.0.50         [.] Fget_buffer
     0.02%   -0.01%  emacs-27.0.50         [.] overlays_at
     0.02%   -0.01%  [wl]                  [k] osl_readl
     0.02%   -0.01%  emacs-27.0.50         [.] set_point_both
     0.02%           emacs-27.0.50         [.] message3_nolog
     0.02%           libX11.so.6.3.0       [.] _XGetRequest
     0.02%           libc-2.23.so          [.] __sprintf_chk
     0.02%           emacs-27.0.50         [.] adjust_markers_for_insert
     0.02%           emacs-27.0.50         [.] adjust_suspend_auto_hscroll
0.02% emacs-27.0.50 [.] get_char_property_and_overlay
     0.01%           emacs-27.0.50         [.] window_box_width
     0.01%           emacs-27.0.50         [.] Fcons
     0.01%           libxcb.so.1.1.0       [.] 0x0000000000009cca
     0.01%   -0.01%  emacs-27.0.50         [.] arith_driver
     0.01%   -0.01%  emacs-27.0.50         [.] resize_mini_window
     0.01%           emacs-27.0.50         [.] unchain_marker
     0.01%           emacs-27.0.50         [.] face_for_char
     0.01%           emacs-27.0.50         [.] unblock_input_to
     0.01%           emacs-27.0.50         [.] unblock_input
0.01% emacs-27.0.50 [.] balance_possible_root_interval
     0.01%           emacs-27.0.50         [.] add_text_properties_1
     0.01%           emacs-27.0.50         [.] save_restriction_restore
     0.01%           emacs-27.0.50         [.] funcall_subr
     0.01%           emacs-27.0.50         [.] gap_right
     0.01%   -0.01%  emacs-27.0.50         [.] Fcurrent_buffer
     0.01%           libXrender.so.1.3.0   [.] XRenderFillRectangle
     0.01%           libXext.so.6.4.0      [.] XdbeSwapBuffers
0.01% emacs-27.0.50 [.] get_glyph_string_clip_rects.part.72
     0.01%           emacs-27.0.50         [.] Fwhile
     0.01%           emacs-27.0.50         [.] window_wants_mode_line
     0.01%           emacs-27.0.50         [.] display_echo_area_1
     0.01%           libXft.so.2.3.2       [.] XftDrawSetClipRectangles
     0.01%           emacs-27.0.50         [.] append_space_for_newline
     0.01%           emacs-27.0.50         [.] x_update_end
     0.01%           emacs-27.0.50         [.] Fforward_line
     0.01%           emacs-27.0.50         [.] address@hidden
     0.01%           emacs-27.0.50         [.] make_uninit_multibyte_string
     0.01%           emacs-27.0.50         [.] prepare_to_modify_buffer_1
     0.01%           emacs-27.0.50         [.] Fstring_equal
     0.01%           emacs-27.0.50         [.] init_glyph_string
     0.01%           libc-2.23.so          [.] _IO_old_init
     0.01%           libXrender.so.1.3.0   [.] XRenderFindDisplay
     0.01%           emacs-27.0.50         [.] Fnreverse
     0.01%           emacs-27.0.50         [.] arithcompare
     0.01%           emacs-27.0.50         [.] font_get_frame_data
     0.01%           emacs-27.0.50         [.] window_box_left
     0.01%           libX11.so.6.3.0       [.] XSetClipRectangles
     0.01%   -0.01%  emacs-27.0.50         [.] Flength
     0.01%           emacs-27.0.50         [.] previous_interval
     0.01%           libXft.so.2.3.2       [.] 0x0000000000007294
0.01% emacs-27.0.50 [.] x_compute_glyph_string_overhangs
     0.01%           emacs-27.0.50         [.] address@hidden
     0.01%           libXrender.so.1.3.0   [.] XRenderCompositeString16
     0.01%           emacs-27.0.50         [.] message3
     0.01%           emacs-27.0.50         [.] xftfont_encode_char
     0.01%           emacs-27.0.50         [.] assign_row
     0.01%           emacs-27.0.50         [.] prepare_desired_row
     0.01%           emacs-27.0.50         [.] xftfont_draw
     0.01%           libXext.so.6.4.0      [.] XextFindDisplay
0.01% libpthread-2.23.so [.] pthread_cond_broadcast@@GLIBC_2.3.2
     0.01%           libXft.so.2.3.2       [.] XftDrawGlyphs
     0.01%           emacs-27.0.50         [.] marker_position
     0.01%           emacs-27.0.50         [.] funcall_lambda
     0.01%           emacs-27.0.50         [.] gettime
     0.01%           libpthread-2.23.so    [.] __GI___libc_recvmsg
     0.01%           emacs-27.0.50         [.] lisp_time_struct
     0.01%           emacs-27.0.50         [.] echo_area_display
     0.01%           emacs-27.0.50         [.] CHECK_MARKER
     0.01%           emacs-27.0.50         [.] del_range_2
     0.01%           emacs-27.0.50         [.] prepare_face_for_display
     0.01%           emacs-27.0.50         [.] interval_deletion_adjustment
     0.01%           libc-2.23.so          [.] strlen
     0.01%           emacs-27.0.50         [.] verify_interval_modification
     0.01%           emacs-27.0.50         [.] count_size_as_multibyte
     0.01%           emacs-27.0.50         [.] adjust_overlays_for_insert
0.01% libXrender.so.1.3.0 [.] XRenderSetPictureClipRectangles
     0.01%           emacs-27.0.50         [.] buffer_local_value
     0.01%           emacs-27.0.50         [.] adjust_window_count
0.01% emacs-27.0.50 [.] notice_overwritten_cursor.part.52
     0.01%           libc-2.23.so          [.] __GI___writev
     0.01%           emacs-27.0.50         [.] record_in_backtrace
     0.01%           emacs-27.0.50         [.] save_restriction_save
     0.01%           emacs-27.0.50         [.] Fget_text_property
     0.01%   -0.00%  [vdso]                [.] __vdso_clock_gettime
     0.01%           emacs-27.0.50         [.] window_wants_header_line
     0.01%           emacs-27.0.50         [.] Fmessage
     0.01%           emacs-27.0.50         [.] FUNCTIONP
     0.01%           emacs-27.0.50         [.] window_display_table
     0.01%           emacs-27.0.50         [.] maybe_quit
     0.01%           emacs-27.0.50         [.] clear_glyph_matrix
     0.01%   -0.00%  emacs-27.0.50         [.] with_echo_area_buffer
     0.01%           libc-2.23.so          [.] __libc_enable_asynccancel
     0.01%           emacs-27.0.50         [.] should_produce_line_number
     0.01%           emacs-27.0.50         [.] x_set_glyph_string_clipping
     0.01%           emacs-27.0.50         [.] set_message_1
     0.01%           emacs-27.0.50         [.] del_range_both
     0.01%           emacs-27.0.50         [.] record_insert
     0.01%           emacs-27.0.50         [.] adjust_overlays_for_delete
     0.01%   +0.00%  libc-2.23.so          [.] _int_free
     0.01%           libc-2.23.so          [.] __strchrnul
     0.01%           emacs-27.0.50         [.] Fgoto_char
     0.01%           emacs-27.0.50         [.] free_misc
     0.01%           emacs-27.0.50         [.] draw_window_fringes
     0.01%           emacs-27.0.50         [.] x_flush.isra.37.part.38
     0.01%           libpthread-2.23.so    [.] __errno_location
     0.01%           emacs-27.0.50         [.] make_float
     0.01%           emacs-27.0.50         [.] fill_glyph_string
     0.01%           emacs-27.0.50         [.] Fget
     0.01%           emacs-27.0.50         [.] Flocal_variable_p
     0.01%           emacs-27.0.50         [.] decode_time_components
     0.01%           emacs-27.0.50         [.] address@hidden
     0.01%           emacs-27.0.50         [.] row_for_charpos_p
     0.01%           emacs-27.0.50         [.] load_overlay_strings
     0.01%           emacs-27.0.50         [.] allocate_misc
     0.01%   -0.00%  libX11.so.6.3.0       [.] _XSend
     0.01%           libX11.so.6.3.0       [.] _XData32
     0.01%   -0.00%  emacs-27.0.50         [.] buf_bytepos_to_charpos
     0.01%           emacs-27.0.50         [.] face_at_buffer_position
     0.01%           emacs-27.0.50         [.] invalidate_current_column
     0.01%           emacs-27.0.50         [.] find_composition
     0.01%           emacs-27.0.50         [.] x_draw_window_cursor
     0.01%           emacs-27.0.50         [.] x_flip_and_flush
     0.01%           libc-2.23.so          [.] _IO_no_init
     0.01%           emacs-27.0.50         [.] Ftime_subtract
     0.01%           emacs-27.0.50         [.] row_hash
     0.01%           emacs-27.0.50         [.] lookup_basic_face
     0.01%           emacs-27.0.50         [.] address@hidden
     0.01%           emacs-27.0.50         [.] Fset_buffer
     0.01%           emacs-27.0.50         [.] produce_special_glyphs
0.00% emacs-27.0.50 [.] x_draw_glyph_string_background.part.44
     0.00%           [vdso]                [.] 0x0000000000000939
     0.00%           emacs-27.0.50         [.] make_save_obj_obj_obj_obj
     0.00%           libc-2.23.so          [.] __GI___libc_poll
     0.00%           emacs-27.0.50         [.] do_specbind
     0.00%           libXft.so.2.3.2       [.] XftGlyphRender
     0.00%           emacs-27.0.50         [.] move_it_to
     0.00%           emacs-27.0.50         [.] make_current.isra.14
     0.00%           emacs-27.0.50         [.] Fnext_single_property_change
     0.00%           emacs-27.0.50         [.] handle_face_prop
     0.00%           libX11.so.6.3.0       [.] _XFlush
     0.00%           emacs-27.0.50         [.] unwind_with_echo_area_buffer
     0.00%           emacs-27.0.50         [.] evaporate_overlays
     0.00%           emacs-27.0.50         [.] sort_overlays
     0.00%           emacs-27.0.50         [.] del_range_1
     0.00%           libX11.so.6.3.0       [.] XFlush
     0.00%           emacs-27.0.50         [.] try_window
     0.00%           emacs-27.0.50         [.] x_set_glyph_string_gc
     0.00%           libc-2.23.so          [.] malloc_consolidate
     0.00%           emacs-27.0.50         [.] handle_stop
     0.00%           emacs-27.0.50         [.] recenter_overlay_lists
     0.00%           libX11.so.6.3.0       [.] address@hidden
     0.00%           emacs-27.0.50         [.] modify_text_properties
     0.00%           emacs-27.0.50         [.] delete_interval
     0.00%           emacs-27.0.50         [.] window_text_bottom_y
     0.00%   +0.00%  emacs-27.0.50         [.] copy_text
     0.00%           emacs-27.0.50         [.] set_default_internal
     0.00%   +0.00%  libxcb.so.1.1.0       [.] xcb_writev
     0.00%           emacs-27.0.50         [.] temp_set_point_both
     0.00%           emacs-27.0.50         [.] insert_1_both
     0.00%           emacs-27.0.50         [.] record_property_change
     0.00%           emacs-27.0.50         [.] lisp_align_malloc
     0.00%           emacs-27.0.50         [.] x_mark_frame_dirty
     0.00%   +0.00%  emacs-27.0.50         [.] text_quoting_style
     0.00%           libc-2.23.so          [.] __GI___mempcpy
     0.00%           emacs-27.0.50         [.] Ffloat_time
     0.00%           emacs-27.0.50         [.] x_write_glyphs
     0.00%   +0.00%  emacs-27.0.50         [.] insert_from_string_1
     0.00%           emacs-27.0.50         [.] Fpoint
     0.00%           libc-2.23.so          [.] __vsprintf_chk
     0.00%           libc-2.23.so          [.] hack_digit
     0.00%           emacs-27.0.50         [.] grow_specpdl
     0.00%           emacs-27.0.50         [.] time_arith
     0.00%           emacs-27.0.50         [.] update_end
     0.00%           emacs-27.0.50         [.] allocate_string_data
     0.00%           emacs-27.0.50         [.] save_excursion_restore
     0.00%   +0.00%  emacs-27.0.50         [.] Flet
     0.00%           emacs-27.0.50         [.] mem_rotate_right
     0.00%           emacs-27.0.50         [.] fetch_buffer_markers
     0.00%           emacs-27.0.50         [.] move_gap_both
     0.00%           emacs-27.0.50         [.] xmalloc
     0.00%           emacs-27.0.50         [.] update_begin
     0.00%           emacs-27.0.50         [.] float_arith_driver
     0.00%           emacs-27.0.50         [.] make_specified_string
     0.00%           emacs-27.0.50         [.] handle_composition_prop
     0.00%           emacs-27.0.50         [.] display_and_set_cursor
     0.00%           emacs-27.0.50         [.] compute_line_metrics
     0.00%           emacs-27.0.50         [.] address@hidden
     0.00%           libc-2.23.so          [.] free
     0.00%           emacs-27.0.50         [.] Fplist_get
     0.00%           libgdk-3.so.0.1800.9  [.] gdk_display_manager_get
     0.00%           emacs-27.0.50         [.] make_interval
     0.00%           libxcb.so.1.1.0       [.] xcb_poll_for_event
     0.00%           emacs-27.0.50         [.] adjust_markers_for_delete
     0.00%           emacs-27.0.50         [.] do_pending_window_change
     0.00%           emacs-27.0.50         [.] address@hidden
     0.00%           libc-2.23.so          [.] _itoa_word
     0.00%           emacs-27.0.50         [.] disassemble_lisp_time
     0.00%           emacs-27.0.50         [.] Ftext_properties_at
     0.00%           emacs-27.0.50         [.] composition_reseat_it
     0.00%           libX11.so.6.3.0       [.] _XEventsQueued
     0.00%           emacs-27.0.50         [.] minmax_driver
     0.00%           emacs-27.0.50         [.] set_marker_restricted_both
     0.00%           emacs-27.0.50         [.] graft_intervals_into_buffer
     0.00%           emacs-27.0.50         [.] disp_char_vector
     0.00%           libc-2.23.so          [.] __clock_gettime
     0.00%           emacs-27.0.50         [.] CHECK_STRING_OR_BUFFER
     0.00%           emacs-27.0.50         [.] intervals_equal
     0.00%           emacs-27.0.50         [.] ensure_echo_area_buffers
     0.00%           emacs-27.0.50         [.] invalidate_buffer_caches
     0.00%           emacs-27.0.50         [.] set_marker_both
     0.00%   +0.00%  emacs-27.0.50         [.] record_unwind_protect
     0.00%           emacs-27.0.50         [.] run_hook_with_args
     0.00%           emacs-27.0.50         [.] set_point_from_marker
     0.00%           emacs-27.0.50         [.] list4
     0.00%           libX11.so.6.3.0       [.] XSetClipMask
     0.00%           emacs-27.0.50         [.] record_buffer_markers
     0.00%           emacs-27.0.50         [.] default_value
             +0.00%  libXext.so.6.4.0      [.] 0x000000000000bf10
             +0.00%  emacs-27.0.50         [.] Fsetq
             +0.00%  emacs-27.0.50         [.] reseat_1
             +0.00%  emacs-27.0.50         [.] update_compositions

this is what perf annotate shows when invoked on buf_charpos_to_bytepos (slow case):

│ ↓ jle 438 4,39 │ mov 0x20(%rax),%r8 8,38 │ mov %rdx,%rbp 0,05 │2f0: mov %rbp,%rdx 0,13 │ mov %r8,%rdi 2,70 │ sub %r13,%rdx 2,22 │ sub %rbx,%rdi 0,05 │ cmp %rdi,%rdx │ ↑ je 1e9 │ /* If we are down to a range of 50 chars, │ don't bother checking any other markers; │ scan the intervening chars directly now. */ │ if (best_above - best_below < 50) 3,21 │305: cmp $0x31,%rdx │ ↓ jle 480 │ CONSIDER (BUF_ZV (b), BUF_ZV_BYTE (b)); │ if (b == cached_buffer && BUF_MODIFF (b) == cached_modiff) ▒ │ CONSIDER (cached_charpos, cached_bytepos); │ for (tail = BUF_MARKERS (b); tail; tail = tail->next) 2,50 │ mov 0x10(%rax),%rax 4,25 │ test %rax,%rax │ ↓ je 480 │ { │ CONSIDER (tail->charpos, tail->bytepos); 2,64 │31c: mov 0x18(%rax),%rdx 59,16 │ cmp %rdx,%rsi │ ↓ je 638 5,70 │ cmp %rdx,%rsi │ ↑ jl 2e0 0,00 │ cmp %rdx,%r13 │ ↓ jge 438 0,00 │ mov 0x20(%rax),%rbx 0,01 │ mov %rdx,%r13 │ ↑ jmp 2f0 │ marker_byte_position(): │ if (!buf) │ error ("Marker does not point anywhere"); │ eassert (BUF_BEG_BYTE (buf) <= m->bytepos && m->bytepos <= BUF_Z_BYTE (b▒ │ return m->bytepos; │340: mov 0x20(%rdi),%rbx │ ↑ jmpq cb │ nop │ buf_charpos_to_bytepos(): │ If at any point we can tell that the space between those ▒ │ two best approximations is all single-byte, │ we interpolate the result immediately. */ │ CONSIDER (BUF_PT (b), BUF_PT_BYTE (b)); │350: mov 0x2f0(%rdi),%r13 │ cmp %rsi,%r13

to my eyes, the fast case doesn't look too different though:

       │     ↓ jle    438
  0,83 │       mov    0x20(%rax),%r8
  0,93 │       mov    %rdx,%rbp
       │2f0:   mov    %rbp,%rdx
  0,06 │       mov    %r8,%rdi
  0,20 │       sub    %r13,%rdx
  0,11 │       sub    %rbx,%rdi
  0,12 │       cmp    %rdi,%rdx
       │     ↑ je     1e9
       │
       │           /* If we are down to a range of 50 chars,
       │              don't bother checking any other markers;
       │              scan the intervening chars directly now.  */
       │           if (best_above - best_below < 50)
 11,24 │305:   cmp    $0x31,%rdx
       │     ↓ jle    480
       │       CONSIDER (BUF_ZV (b), BUF_ZV_BYTE (b));
       │
       │       if (b == cached_buffer && BUF_MODIFF (b) == cached_modiff)
       │         CONSIDER (cached_charpos, cached_bytepos);
       │
       │       for (tail = BUF_MARKERS (b); tail; tail = tail->next)
  0,16 │       mov    0x10(%rax),%rax
 10,41 │       test   %rax,%rax
       │     ↓ je     480
       │         {
       │           CONSIDER (tail->charpos, tail->bytepos);
  3,19 │31c:   mov    0x18(%rax),%rdx
 42,86 │       cmp    %rdx,%rsi
       │     ↓ je     638
 10,36 │       cmp    %rdx,%rsi
       │     ↑ jl     2e0
  2,24 │       cmp    %rdx,%r13
       │     ↓ jge    438
  0,76 │       mov    0x20(%rax),%rbx
  0,43 │       mov    %rdx,%r13
       │     ↑ jmp    2f0
       │     marker_byte_position():
       │       if (!buf)
       │         error ("Marker does not point anywhere");
       │
│ eassert (BUF_BEG_BYTE (buf) <= m->bytepos && m->bytepos <= BUF_Z_BYTE (bu
       │
       │       return m->bytepos;
       │340:   mov    0x20(%rdi),%rbx
       │     ↑ jmpq   cb
       │       nop
       │     buf_charpos_to_bytepos():
       │
       │          If at any point we can tell that the space between those
       │          two best approximations is all single-byte,
       │          we interpolate the result immediately.  */
       │
       │       CONSIDER (BUF_PT (b), BUF_PT_BYTE (b));
       │350:   mov    0x2f0(%rdi),%r13
       │       cmp    %rsi,%r13

I hope this is of some use, but I'll keep looking for open source files to reproduce the issue



reply via email to

[Prev in Thread] Current Thread [Next in Thread]