This patch includes speed-ups for match in the case of a scalar x and NULL incomparables. For these cases constructing a hash is not necessary.

runs = 1:1e6
system.time( for (i in runs) { match("A",LETTERS, incomparables=NULL) } )
##    user  system elapsed 
##   2.172   0.000   2.173
system.time( for (i in runs) { match("Z",LETTERS, incomparables=NULL) } )
##    user  system elapsed 
##   2.434   0.000   2.438
system.time( for (i in runs) { match("A",LETTERS, incomparables="FOO") } )
##    user  system elapsed 
##   3.184   0.000   3.187
system.time( for (i in runs) { match("Z",LETTERS, incomparables="FOO") } )
##    user  system elapsed 
##   3.375   0.000   3.380
range = 1:24
system.time( for (i in runs) { match(1,range, incomparables=NULL) } )
##    user  system elapsed 
##   2.367   0.000   2.369
system.time( for (i in runs) { match(26,range, incomparables=NULL) } )
##    user  system elapsed 
##   2.472   0.000   2.474
system.time( for (i in runs) { match(1,range, incomparables=2) } )
##    user  system elapsed 
##   3.948   0.001   3.953
system.time( for (i in runs) { match(1,range, incomparables=2) } )
##    user  system elapsed 
##   4.171   0.000   4.177
stopifnot( match("A",LETTERS, incomparables=NULL) == 1 )
stopifnot( match("Z",LETTERS, incomparables=NULL) == 26 )
stopifnot( match(15,11:100, incomparables=NULL) == 5 )
stopifnot( match(15L,11L:100L, incomparables=NULL) == 5 )
stopifnot( is.na(match("FOO", LETTERS, incomparables=NULL)) )
stopifnot( is.na(match(7, 11:20, incomparables=NULL)) )

## Match fast path for length 1 x, where only string encoding differs
tmp <- "年付"
tmp2 <- "\u5e74\u4ed8"
Encoding(tmp) <- "UTF-8"
stopifnot(tmp %in% tmp2)

tmp <- "foo"
tmp2 <- "foo"
Encoding(tmp) <- "unknown"
Encoding(tmp2) <- "UTF-8"
stopifnot(tmp %in% tmp2)