An open community 
of Macintosh users,
for Macintosh users.

FineTunedMac Dashboard widget now available! Download Here

Previous Thread
Next Thread
Print Thread
testing USB C speeds
#45769 07/21/17 03:50 PM
Joined: Aug 2009
OP Offline

Joined: Aug 2009
Since retiring my malfunctioning 2010 MBP and replacing it with a new retina, I have a 1tb SSD to repurpose. Rather than shelling out $350+ for a 1TB USBC external drive, I picked up an Oyen usb-c enclosure for about $30 and dropped in my old drive.

Somewhat surprisingly, the Oyen came with a C/C cable as well as a C/USB3 cable. And this piqued my curiosity as to how to benchmark all of my new kit. The retina has a 2tb SSD in it (got a good deal on apple refurb, so why not?) and would like to see how fast my external drive can go. I'd also like to compare USB-C cables since I now have more than one type. (the TB3 cables that came with my retina's charger, and the spare I got) I can also compare TB3 speeds with USB3.1 speeds, and that I can test through one of several different kinds of adapter I have here, including a thunderbolt dock. (connected via the rare TB3/TB2 adapter, I made sure to get TWO of them when I ordered my computer)

So what's everyone''s suggestion on how to benchmark this?

(also, the TB3/TB2 adapter I ordered in January because it didn't get on my order for my new retina at work... JUST arrived last week... wow.)


I work for the Department of Redundancy Department
Re: testing USB C speeds
Virtual1 #45770 07/21/17 04:32 PM
Joined: Aug 2009
Likes: 8
Offline

Joined: Aug 2009
Likes: 8
Black Magic offers a piece of software that can test read/write speeds.

Let us know the results.


On a Mac since 1984.
Currently: 24" M1 iMac, M2 Pro Mac mini with 27" BenQ monitor, M2 Macbook Air, MacOS 14.x; iPhones, iPods (yes, still) and iPads.
Re: testing USB C speeds
Virtual1 #45778 07/21/17 09:56 PM
Joined: Aug 2009
Offline

Joined: Aug 2009
Here's a Link that helps explain the complex differentiation of all these cables, particularly the length of TB3 cables, and the resulting speeds when mixing connection ends. ...Be sure to peruse the lower part of the web page. While the various cable speeds are theoretical, understanding will help when comparing speed tests.


MacStudio M1max - 14.4.1, 64 GB Ram, 4TB SSD; Studio Display; iPhone 13mini; Watch 9; iPadPro (M2) 11" WiFi
Re: testing USB C speeds
Virtual1 #45779 07/22/17 12:04 AM
Joined: Aug 2009
Likes: 1
Offline

Joined: Aug 2009
Likes: 1
I just did the very same thing last week. I'd put a Samsung EVO SSD in my 2012 Macbook Pro a few years back, then upgraded last week to a new MBP. So I pulled the SSD out of the old one and put it in an external USB C enclusure, which came with a USB C cable.

What I've found is that it's so fast the limiting factor is actually the SATA speed of the drive interface. Continuous reads with a short USB C<->C cable are blindingly fast.

Sadly, the enclosure (an Askey enclosure) does not pass along TRIm commands, so TRIM is not enabled for the external drive.


Photo gallery, all about me, and more: www.xeromag.com/franklin.html
Re: testing USB C speeds
tacit #45792 07/24/17 06:11 PM
Joined: Aug 2009
OP Offline

Joined: Aug 2009
Originally Posted By: tacit
Sadly, the enclosure (an Askey enclosure) does not pass along TRIm commands, so TRIM is not enabled for the external drive.

Huh. I wouldn't have even considered that possible to not pass on...


I work for the Department of Redundancy Department
Re: testing USB C speeds
Virtual1 #45871 07/30/17 09:55 PM
Joined: Aug 2009
Likes: 1
Offline

Joined: Aug 2009
Likes: 1
I know, right? It's frustrating. About half the external USB enclosures I've seen support passing TRIM commands through, about half don't.


Photo gallery, all about me, and more: www.xeromag.com/franklin.html
Re: testing USB C speeds
tacit #45903 08/02/17 08:05 PM
Joined: Aug 2009
OP Offline

Joined: Aug 2009
OK here we go. I just got in two (of an order of 44?) new iMacs from Apple, and was befuddled by my inability to access it via target disk mode. After a bit of digging I discovered that the Macintoshes with USB-C on them will flat-out IGNORE connections through a USB-C cable. Yes, you read that right. No USB-C cable.

"But then, how...?" you ask! According to Apple, they will only work in target mode using USB-3.1 (aka Thunderbolt-3) cables. Important to note - Apple's USB-C cables are no exception to this rule and cannot be used to connect a mac in target mode. So they now produce a computer with a feature that their own accessories don't support.... genius! I'm rather annoyed by this as I bought a spare USB-C cable when I ordered this retina specifically for accessing macs in target mode.

So at home I have this new Oyen USB-3.1 enclosure that (to my surprise) came with an unmarked generic cable. Took lots of stuff home to test. Stopped by walmart on the way home for some minor groceries, swung through their computer department, and surprise, they carried a Belkin USB-3.1 cable ($30) so grabbed that too for testing. (I was really expecting walmart would have a lower price, but whatever, I'm not ordering one online, I want to test this NOW, saves me a trip to best-buy)

So as mentioned above, I didn't really know HOW I was going to do this testing. I had a few scripts sort of suited to this but not really, and so ended up writing something new for just this purpose. And the results were VERY surprising.

# all test ran 2017-08-02 on MacBook Pro (15-inch, 2016) - external tests used rear left USB-C port


### OYEN USB-3.1 enclosure ("Oyen Digital Mini Pro") with SanDisk II 960GB SSD

# 385 MB/sec via generic bundled USB-C cable
# 456 MB/sec via generic bundled USB-C cable
# 454 MB/sec via belkin Thunderbolt-3/USB-C cable
# 39 MB/sec via Apple USB-C cable


### Retina internal storage model "APPLE SSD SM2048L" 2TB SSD

# 2096 MB/sec internal PCI-E
# 1993 MB/sec internal PCI-E
# 1937 MB/sec internal PCI-E


### LaCie Rugged Thunderbolt-2 enclosure with SanDisk II 512GB SSD

# 336 MB/sec via attached Thunderbolt-2 cable via Apple TB-2/TB-3 adapter
# 343 MB/sec via USB-3 cable via Nonda USB-3/USB-C adapter
# 337 MB/sec via USB-3 cable via Apple USB-3/USB-C adapter
# 335 MB/sec via USB-3 cable via Anker USB/Ethernet mini dock (model A8303)
# 286 MB/sec via USB-3 cable via OWC Thunderbolt2 Dock via Apple Thunderbolt-2 cable via Apple TB-2/TB-3 adapter


### DOES NOT WORK:

# - any Thunderbolt-3 Macintosh in target disk mode connected via Apple USB-C cable
# - any USB-C device connected via Apple TB-2/TB-3 adapter via Apple Thunderbolt-2 cable via Apple TB-2/TB-3 adapter

# the failure of target disk mode using USB-C (and not Thunderbolt-3) grade cables came as quite a shock to me and
# is the reason I wrote and performed thee tests

# the failure of the "adapt Thunderbolt-3 through Thunderbolt-2 cable" test was also a surprise, but is much less of a problem


Check out that Oyen via Apple's "USB-C" cable.... wow. In addition to not being a USB-3.1 cable, THAT is NOT a USB-C cable. THAT is a USB-2.1 cable pretending to be a USB-C cable. 39MB/sec is max USB-2.1 ("super-speed") speed.

A few of the tests show up more than once as I ran them again and got different numbers. I'm not sure why, as I'm being pretty careful to make sure things are ready and consistent. Nothing is too far off though to suggest a big problem. And oh my good lord, just look at those internal speeds! 2GB/sec! I don't have another mac here to test right now, but I'm wondering if I will continue to see speeds like that when I get back to work with my (real) USB-3.1 cable to test target mode?

My LaCie tests suggest that USB-3.0 and Thunderbolt-2 are about the same, performance-wise. The SSDs in the LaCie and the Oyen are about on par and should max out around the same speed, so the LaCie is capping out a bit on the USB-3.0 / Thunderbolt-2 interface.



and of course, here's my test code. Please feel free to use and submit your results. Try to be as specific as possible about the test you run, including the computer, any cables or adapters you use with as much detail as possible on them, as well as the enclosure AND the drive in the enclosure.

Code:
#!/bin/bash

vers=2017.08.02.A
# check read speeds on a disk





################################################################################
###  SUBROUTINES
################################################################################


########################################
###  SCAN DISKS
########################################

# display available disks and get disk selection
scan_disks () {

# display list of physical disks to user
clear
echo
echo "Physical disks:"
echo
diskutil list physical
echo

# load list of physical disks
diskutil list physical | grep "^/" > "$tempfile"
disks=0
while read x ; do
  y=${x%% *}  # "/dev/disk5
  disk[disks]="/dev/r${y:5}"  # "/dev/rdisk5
  ((disks++))
done < "$tempfile"
rm "$tempfile"
echo "loaded $disks disks"
echo
echo

}



########################################
### TEST AT
########################################

# perform one read test on a disk
# supply $1 as MB index to start scan at
# preset source to disk device, sample_mb amount of MB to scan
test_at () {

start_mb=$1
echo -n "  testing read speed at $start_mb... "

dd if=$source bs=1m count=$sample_mb iseek=$start_mb of=/dev/null 2> "$tempfile"

speed=$(cat "$tempfile" | grep "transferred")  # "1919942656 bytes transferred in 4.716991 secs (407026996 bytes/sec)"
speed=${speed#*(}  # "407026996 bytes/sec)"
speed=${speed% *}  # "407026996"
((speed=speed/1024/1024))
rm "$tempfile"

echo "$speed MB/sec"
echo

# add up for averge when we're done testing this disk
((average+=speed))

}



########################################
### TEST ONE
########################################

# select and test one disk
test_one () {

### select disk to test
if [ $disks == 1 ] ; then
  source=${disk[0]}
else
  scan_disks
  PS3=$'\n'"Select disk to test, or 0 to rescan : "
  source=""
  while [ -z "$source" ] ; do
    select source in ${disk[@]} ; do
      # disk was selected
      break
    done
    if [ -z "$source" ] ; then
      # recan
      scan_disks
    fi
  done
fi
echo
echo "Selected device: $source"
echo

### get capacity of selected disk
bytes=$(diskutil info -plist $source | grep -A1 "<key>Size</key>" | grep "integer" | cut -d ">" -f 2 | cut -d "<" -f 1)  # "960197124096"
((mb=bytes/1024/1024))
echo "selected disk is $mb MB in size"
echo

### make sure drive is spun up and head is seeked to start before starting test
dd if=$source bs=1m count=1 of=/dev/null 2> /dev/null

### read 1MB to get an idea of the speed of this disk
dd if=$source bs=1m count=1 iseek=$((mb/2+1)) of=/dev/null 2> "$tempfile"
speed=$(cat "$tempfile" | grep "transferred")  # "1919942656 bytes transferred in 4.716991 secs (407026996 bytes/sec)"
speed=${speed#*(}  # "407026996 bytes/sec)"
speed=${speed% *}  # "407026996"
((speed=speed/1024/1024))  # speed is now in MB/sec
rm "$tempfile"

### calculate sample size - we want our read tests to each take about five seconds
((sample_mb=speed*5))
echo "Will sample $sample_mb MB at the start, middle, and end of the disk:"
echo

# perform three read tests, display and average speed
average=0
test_at 0
test_at $((mb/2))
test_at $((mb-sample_mb))
((average/=3))

echo "average speed of $average MB/sec"
echo
echo

}





################################################################################
################################################################################
###
###  PROGRAM START
###
################################################################################
################################################################################


tempfile="${TMPDIR}read_speeds.tmp"

### verify user is root
if [ $UID != 0 ] ; then
  echo
  if [ -z "$(echo " $(dscl . -read /Groups/admin | grep "GroupMembership: " | cut -d ':' -f 2) " | grep " $USER ")" ] ; then
    echo "You will need to login as an admin to run this program."
    echo
    exit
  fi
  echo -n "Please enter your admin " # Password:
  sudo "$0" "$1" "$2"
  exit
fi


### test over and over
while [ true ] ; do
  test_one
  read -n1 -p "Press [RETURN] to scan for disks again : " x
done

### we never get here





################################################################################
################################################################################
###
###  NOTES
### 
################################################################################
################################################################################


# all test ran 2017-08-02 on MacBook Pro (15-inch, 2016) - external tests used rear left USB-C port


###  OYEN USB-3.1 enclosure ("Oyen Digital Mini Pro") with SanDisk II 960GB SSD

#   385 MB/sec  via generic bundled USB-C cable
#   456 MB/sec  via generic bundled USB-C cable
#   454 MB/sec  via belkin USB-C cable
#    39 MB/sec  via Apple USB-C cable


###  Retina internal storage model "APPLE SSD SM2048L" 2TB SSD

#  2096 MB/sec  internal PCI-E
#  1993 MB/sec  internal PCI-E
#  1937 MB/sec  internal PCI-E


###  LaCie Rugged Thunderbolt-2 enclosure with SanDisk II 512GB SSD

#   336 MB/sec  via attached Thunderbolt-2 cable via Apple TB-2/TB-3 adapter
#   343 MB/sec  via USB-3 cable via Nonda USB-3/USB-C adapter
#   337 MB/sec  via USB-3 cable via Apple USB-3/USB-C adapter
#   335 MB/sec  via USB-3 cable via Anker USB/Ethernet mini dock (model A8303)
#   286 MB/sec  via USB-3 cable via OWC Thunderbolt2 Dock via Apple Thunderbolt-2 cable via Apple TB-2/TB-3 adapter


###  DOES NOT WORK:

# - any Thunderbolt-3 Macintosh in target disk mode connected via Apple USB-C cable
# - any USB-C device connected via Apple TB-2/TB-3 adapter via Apple Thunderbolt-2 cable via Apple TB-2/TB-3 adapter

# the failure of target disk mode using USB-C (and not Thunderbolt-3) grade cables came as quite a shock to me and
# is the reason I wrote and performed thee tests

# the failure of the "adapt Thunderbolt-3 through Thunderbolt-2 cable" test was also a surprise, but is much less of a problem




I work for the Department of Redundancy Department
Re: testing USB C speeds
tacit #45904 08/02/17 08:25 PM
Joined: Aug 2009
OP Offline

Joined: Aug 2009
Originally Posted By: tacit
Sadly, the enclosure (an Askey enclosure) does not pass along TRIm commands, so TRIM is not enabled for the external drive.

BTW, how do you test that without erasing something? Is there a way to pull a "supported commands" list from a peripheral?


I work for the Department of Redundancy Department
Re: testing USB C speeds
Virtual1 #45905 08/02/17 09:19 PM
Joined: Aug 2009
OP Offline

Joined: Aug 2009
Another curious update... I noticed that read speeds on my internal drive were consistently slower at the start. So I modified the script to allow for more samples if specified. This was a consistent result of taking 10 samples on my internal SSD:

Selected device: /dev/rdisk0

selected disk is 1863 GB in size

will take 10 samples of 7415 MB across the disk:

testing read speed at 0 MB ... 1241 MB/sec

testing read speed at 211221 MB ... 1807 MB/sec

testing read speed at 422442 MB ... 2076 MB/sec

testing read speed at 633664 MB ... 2060 MB/sec

testing read speed at 844885 MB ... 2200 MB/sec

testing read speed at 1056107 MB ... 2265 MB/sec

testing read speed at 1267328 MB ... 2309 MB/sec

testing read speed at 1478550 MB ... 2294 MB/sec

testing read speed at 1689771 MB ... 2326 MB/sec

testing read speed at 1900993 MB ... 2187 MB/sec

average speed of 2076 MB/sec


Interesting.... the first chunk of the disk is consistently half the speed of the rest of the disk. (and it always gets a little bit slower at the end too)
I tend to see the opposite effect on spinning drives, were access speeds slow down as I go up in block numbers. The increase is usually very linear and present on all drives I test, to some degree or other. They don't usually change much though... I might see 140mb/sec at block 0 and 115mb/sec at the end on a spinner. The results I'm seeing here are speeds doubling.


I work for the Department of Redundancy Department
Re: testing USB C speeds
Virtual1 #45915 08/03/17 03:13 PM
Joined: Aug 2009
OP Offline

Joined: Aug 2009
FWIW, I tested a new iMac in target mode plugged into a fairly new retina using the Belkin cable, and speeds were about equal with the Oyen eternal (~540MB/sec) so that seems to be the functional limit of external USB-C / Thunderbolt-2 attached storage.


I work for the Department of Redundancy Department
Re: testing USB C speeds
Virtual1 #45917 08/03/17 04:43 PM
Joined: Aug 2009
Likes: 8
Offline

Joined: Aug 2009
Likes: 8
Originally Posted By: Virtual1
Check out that Oyen via Apple's "USB-C" cable.... wow. In addition to not being a USB-3.1 cable, THAT is NOT a USB-C cable. THAT is a USB-2.1 cable pretending to be a USB-C cable. 39MB/sec is max USB-2.1 ("super-speed") speed.


Overall, interesting. Could you clarify the above. I may have missed it, but where did this Apple USB-C cable come from? Apple? It makes no sense unless it is done for product economy.


On a Mac since 1984.
Currently: 24" M1 iMac, M2 Pro Mac mini with 27" BenQ monitor, M2 Macbook Air, MacOS 14.x; iPhones, iPods (yes, still) and iPads.
Re: testing USB C speeds
Ira L #45919 08/03/17 11:51 PM
Joined: Aug 2009
Likes: 15
Online

Joined: Aug 2009
Likes: 15
It'll never come to pass, but I'd love to see Apple split cables, adaptors, drives, and RAM into a separate, publicly disclosed profit center...retroactively. tongue

Edit: Oh, and disc drives, too.

Last edited by artie505; 08/04/17 12:10 AM.

The new Great Equalizer is the SEND button.

In Memory of Harv: Those who can make you believe absurdities can make you commit atrocities. ~Voltaire
Re: testing USB C speeds
Ira L #45923 08/04/17 12:37 PM
Joined: Aug 2009
OP Offline

Joined: Aug 2009
Originally Posted By: Ira L
Originally Posted By: Virtual1
Check out that Oyen via Apple's "USB-C" cable.... wow. In addition to not being a USB-3.1 cable, THAT is NOT a USB-C cable. THAT is a USB-2.1 cable pretending to be a USB-C cable. 39MB/sec is max USB-2.1 ("super-speed") speed.


Overall, interesting. Could you clarify the above. I may have missed it, but where did this Apple USB-C cable come from? Apple? It makes no sense unless it is done for product economy.


At the time I placed my original order, Apple did not stock a "Thunderbolt 3" cable. The only cable they offered was the "USB-C power cable" that goes with their power adapter. Since I always order a spare power adapter when I get a new laptop, I bought a spare pack and then realized I had to get the cable separately. (because when you buy a new USB-C pack, it does NOT come with a cable) But I also needed a USB-C/TB-3 cable, so I thought that cable could just do double-duty.

I didn't get an opportunity to test it until recently, because for awhile my laptop and a few others here were the only USB-C devices on site. But now I'm refreshing lab AND adding a new lab, so I got in the first trickle of the 44 machines to work on. And to my great surprise, the white USB-C power cable I have is almost for thunderbolt connections.

About this same time I got in a USB-C enclosure to install the 960gb SSD from my dead MacBook into, and that's what's lead to the flurry of my testing. I found that the white USB-C cable supplied by Apple will do, at best, USB-2.1 ("USB High-Speed') model, at a rate of 480mbps. It won't even do USB-3 speeds (5Gbps), let alone USB-3.1 speeds (10Gbps) or any variation of Thunderbolt-3 speeds. (20-40Gbps)

When attached to a Mac with Thunderbolt Target Disk Mode, it won't even attempt to function at USB-2.1 speeds (480Mbps) so it just ignores you. This being an Apple product, (and at the time I got it, the ONLY USB-C cable available at Apple.com) I was taken quite by surprise. Now I see they have the Belkin line available. This isn't very obvious on their store pages, but there are several articles and forum discussions where this difference is clarified. (which weren't there at the time I bought the extra cable!)

My personally-owned USB-C (data) kit currently includes:
- a new retina
- Oyen USB-C enclosure
- an 18" generic thunderbolt-3 cable (bundled with the Oyen)
- a 3ft Belkin Thunderbolt-3 (20Gbps) cable (Walmart) aka "4K"
- a 18" Belkin Thunderbolt-3 (40Gbps) cable (BestBuy) aka "5K"

I bought the 40 belkin last night just to see if there was a difference, but given the drive in the Oyen tops out around 560MB/sec, (it's a SanDisk Ultra II) that's about 5Gbps, none of the different cables make any detectable difference. The Oyen WILL also work when plugged in with the Apple USB-C cable, but at 480Mbps speed (about 39MB/sec) Both of the Belkin cables cost $30. BestBuy also stocks a 3ft 40Gbps cable but the price is much higher, about $75 iirc. 18" is a bit cramped for attaching two computers together for imaging, but since the 3ft cable I have is 20Gbps, there's no point in spending more on a 3 foot 40. (so if you want a cable, get the 3ft 20Gbps from wallyworld) Disappointingly, my tests seem to suggest that despite the target disk mode now requiring a TB3 cable (intended for 20-40Gbps), they only will transfer at 5Gbps at most. (which is the USB-3.1 spec speed) I reran my test just now and found that via a 40Gbps cable, this new iMac will only test at 524MB/sec. (for practical purposes, I multiply MB/sec by 9 to get Mbps - 524MB/sec works out to 4716Mbps) Makes me also wonder if there's some really high speed caching that's occurring on the internal PCI-E SSD but that only works for booted not for target disk mode. Or maybe they'll upgrade/fix that in later models. So many questions!

Also of note... the 18" from Oyen and the 3ft 20Gbps Belkin cables are the same thickness, but the 18" 40Gbps is slightly thicker. I assume it's either got another pair or two of wires in it, more/better shielding, or both, to maintain the higher speed. (and likely a faster Thunderbolt transceiver chip in both connectors) The USB-C power cable from Apple is thinner than the 20's. Both my Belkin cables are rated 60W, but I've seen them listed as 100W in other places. (I think that refers to the thunderbolt spec max rather than what the cable can do)

Interesting.... when a new iMac is in Thunderbolt Target Disk Mode, it does NOT post external storage to the attached computer. (tried thunderbolt 2 drive via tb2/tb3 adapter, USB3, AND the Oyen via TB3) This is a first, this has worked all the way back to the days of SCSI Target Disk Mode (if any of you can remember that, or rarer still, using that!) I still remember years ago being befuddled with seeing an OS Install CD on my work computer's desktop, whilst opening the optical drive tray and seeing it empty. "Where's that coming from?!!" (I had a PMG4 attached in FWTDM to work on the hard drive, whose HDD I had long since ejected, even out of sight around the corner from my desk, and had NO idea it had a disc in its tray)




I work for the Department of Redundancy Department
Re: testing USB C speeds
Virtual1 #45927 08/04/17 05:02 PM
Joined: Aug 2009
Likes: 8
Offline

Joined: Aug 2009
Likes: 8
That's a good catch on the PMG4 with a disc in its tray. smirk

Now how about repeating all of the above but using various USB-C docks with an assortment of ports! grin

Thanks for all the info.


On a Mac since 1984.
Currently: 24" M1 iMac, M2 Pro Mac mini with 27" BenQ monitor, M2 Macbook Air, MacOS 14.x; iPhones, iPods (yes, still) and iPads.
Re: testing USB C speeds
Virtual1 #45928 08/04/17 07:54 PM
Joined: Aug 2009
Likes: 1
Offline

Joined: Aug 2009
Likes: 1
Originally Posted By: Virtual1
Originally Posted By: tacit
Sadly, the enclosure (an Askey enclosure) does not pass along TRIm commands, so TRIM is not enabled for the external drive.

BTW, how do you test that without erasing something? Is there a way to pull a "supported commands" list from a peripheral?


I've only tested it by attempting to enable TRIM with trimforce, then looking at the system report to see if it's working.

The system report will show Media: SSD and TRIM: enabled with an SSD in a TRIM-capable housing, but will show neither in a housing that doesn't support TRIM.


Photo gallery, all about me, and more: www.xeromag.com/franklin.html

Moderated by  alternaut, cyn 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.4.33 Page Time: 0.033s Queries: 44 (0.026s) Memory: 0.6665 MB (Peak: 0.7955 MB) Data Comp: Zlib Server Time: 2024-03-28 12:50:29 UTC
Valid HTML 5 and Valid CSS