Elisp: Benchmark: current-word vs get-thing-at-point

By Xah Lee. Date: .

current-word vs get-thing-at-point

;; -*- coding: utf-8; lexical-binding: t; -*-
;; 2023-08-02 2023-08-07
;; comparing speed of ways to get current word

(require 'benchmark)

(setq xi 100000)

(benchmark-run xi (current-word))
;; some
;; (0.19 7 0.15)

(benchmark-run xi (xah-get-thing-at-point 'word))
;; some
;; (0.55 14 0.33)

;; byte compiled version
(benchmark-run xi (xah-get-thing-at-point 'word))
;; some
;; (0.24 5 0.11)

(benchmark-run xi (thing-at-point 'word))
;; some
;; (1.1 28 0.6)

Elisp, Benchmark and Unit Testing